Skip to content

Commit 69a480b

Browse files
committed
simplify server.address sources even further
1 parent b3edf6c commit 69a480b

File tree

3 files changed

+11
-52
lines changed

3 files changed

+11
-52
lines changed

docs/http/http-metrics.md

+6-24
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,9 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original
476476

477477
**[4]:** `network.protocol.version` refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
478478

479-
**[5]:** Determined by using the first of the following that applies:
479+
**[5]:** If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then `server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
480480

481-
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) if it's sent in absolute-form.
482-
- Host identifier of the `Host` header.
483-
484-
If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then
485-
`server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
486-
487-
**[6]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier; otherwise, it MUST match `Host` header port identifier.
481+
**[6]:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
488482

489483
**[7]:** If not default (`80` for `http` scheme, `443` for `https`).
490484

@@ -572,15 +566,9 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original
572566

573567
**[4]:** `network.protocol.version` refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
574568

575-
**[5]:** Determined by using the first of the following that applies:
576-
577-
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) if it's sent in absolute-form.
578-
- Host identifier of the `Host` header.
569+
**[5]:** If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then `server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
579570

580-
If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then
581-
`server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
582-
583-
**[6]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier; otherwise, it MUST match `Host` header port identifier.
571+
**[6]:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
584572

585573
**[7]:** If not default (`80` for `http` scheme, `443` for `https`).
586574

@@ -668,15 +656,9 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original
668656

669657
**[4]:** `network.protocol.version` refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
670658

671-
**[5]:** Determined by using the first of the following that applies:
672-
673-
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) if it's sent in absolute-form.
674-
- Host identifier of the `Host` header.
675-
676-
If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then
677-
`server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
659+
**[5]:** If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then `server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
678660

679-
**[6]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier; otherwise, it MUST match `Host` header port identifier.
661+
**[6]:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
680662

681663
**[7]:** If not default (`80` for `http` scheme, `443` for `https`).
682664

docs/http/http-spans.md

+4-19
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,9 @@ For an HTTP client span, `SpanKind` MUST be `Client`.
240240

241241
**[1]:** The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).
242242

243-
**[2]:** Determined by using the first of the following that applies:
243+
**[2]:** If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then `server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
244244

245-
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) if it's sent in absolute-form.
246-
- Host identifier of the `Host` header.
247-
248-
If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then
249-
`server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
250-
251-
**[3]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier; otherwise, it MUST match `Host` header port identifier.
245+
**[3]:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
252246

253247
**[4]:** If not default (`80` for `http` scheme, `443` for `https`).
254248

@@ -313,22 +307,16 @@ In order to route request to a specific application, reverse proxies usually mod
313307

314308
HTTP server frameworks and their instrumentations have limited knowledge about the HTTP infrastructure and intermediaries that requests go through. In a general case, they can only use HTTP request properties such as request target or headers to populate `server.*` attributes.
315309

316-
Certain web frameworks may provide additional information about server. For example CGI specification defines `SERVER_NAME` and `SERVER_PORT` ([RFC 3875][rfc-servername]) variables. HTTP servers usually know server names as they are provided by users in the configuration. See for example, the Apache [`ServerName`][ap-sn] or NGINX [`server_name`][nx-sn] directive.
317-
318-
Still, the original logical server name might not be available to the HTTP server instrumentation or can be inaccurate.
319-
320310
#### Setting `server.address` and `server.port` attributes
321311

322-
In the context of HTTP server, `server.address` and `server.port` attributes capture logical host and port name and intended, whenever possible, to be the same on the client and server sides.
312+
In the context of HTTP server, `server.address` and `server.port` attributes capture the original host name and port. The are intended, whenever possible, to be the same on the client and server sides.
323313

324314
HTTP server instrumentations SHOULD do the best effort when populating `server.address` and `server.port` attributes and SHOULD determine them by using the first of the following that applies:
325315

326316
* The original host which may be passed by the reverse proxy in the [`Forwarded#host`][Forwarded], [`X-Forwarded-Host`][X-Forwarded-Host], or a similar header.
327-
* Server name and port available through web framework or HTTP server properties if they're based on the user configuration. Instrumentations SHOULD NOT use properties that rely on the `Host` header.
328-
* The [request target][request target] if it's passed in the absolute form.
329317
* The `Host` header.
330318

331-
> **Note**: The `Host` header specifies host and port number of the server. The same applies to the `host` identifier of `Forwarded` header, the `X-Forwarded-Host` header, or the authority component in the request target. Instrumentations SHOULD populate both `server.address` and `server.port` attributes by parsing the applicable property.
319+
> **Note**: The `Host` header specifies host and port number of the server. The same applies to the `host` identifier of `Forwarded` header or the `X-Forwarded-Host` header. Instrumentations SHOULD populate both `server.address` and `server.port` attributes by parsing the value of corresponding header.
332320
333321
Application developers MAY overwrite potentially inaccurate values of `server.*` attributes using a [SpanProcessor][SpanProcessor] and MAY capture private host information using applicable [resource attributes](/docs/resource/README.md).
334322

@@ -344,9 +332,6 @@ Application developers MAY overwrite potentially inaccurate values of `server.*`
344332
[request target]: https://www.rfc-editor.org/rfc/rfc9110.html#target.resource
345333
[Forwarded]: https://developer.mozilla.org/docs/Web/HTTP/Headers/Forwarded
346334
[X-Forwarded-Host]: https://developer.mozilla.org/docs/Web/HTTP/Headers/X-Forwarded-Host
347-
[rfc-servername]: https://tools.ietf.org/html/rfc3875#section-4.1.14
348-
[ap-sn]: https://httpd.apache.org/docs/2.4/mod/core.html#servername
349-
[nx-sn]: http://nginx.org/docs/http/ngx_http_core_module.html#server_name
350335

351336
### HTTP Server semantic conventions
352337

model/http-common.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,14 @@ groups:
4444
requirement_level: required
4545
brief: >
4646
Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
47-
note: |
48-
Determined by using the first of the following that applies:
49-
50-
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) if it's sent in absolute-form.
51-
- Host identifier of the `Host` header.
52-
47+
note: >
5348
If an HTTP client request is explicitly made to an IP address, e.g. `http://x.x.x.x:8080`, then
5449
`server.address` SHOULD be the IP address `x.x.x.x`. A DNS lookup SHOULD NOT be used.
5550
- ref: server.port
5651
requirement_level:
5752
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
5853
brief: >
5954
Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
60-
note: >
61-
When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match
62-
URI port identifier; otherwise, it MUST match `Host` header port identifier.
6355
6456
- id: attributes.http.server
6557
type: attribute_group

0 commit comments

Comments
 (0)