Skip to content

HTTP: The definition of server.address differs across various metrics #2443

@antonfirsov

Description

@antonfirsov

Area(s)

HTTP

What's the problem?

The HTTP client request metrics spec (e.g. for http.client.request.duration) and the HTTP client span spec defines server.address as

Host identifier of the "URI origin" HTTP request is sent to.

while in the spec of other metrics (e.g. http.client.connection.duration), and the attribute registry for "Server" it is defined as

Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

This leads to a problem deciding whether the Host header should take precedence over the URI origin. The current wording seems to slightly suggest that request span (and metrics) should use the URI origin while the connection metrics should use the Host header but this doesn't seem to be neither intentional nor clear.

Context: in dotnet/runtime#117049 a user reported a problem with .NET's HttpClient metrics which currently report the URI origin instead of the Host header. While changing this to report the Host header instead seems better from practical POV, the expected behavior is not clear from the current state of the semconv spec.

Describe the solution you'd like

  • Uniformize the specs or make it clear in comments that the expected attribute values differ intentionally across various metrics/spans.
  • In either case, it should be clear if the Host header has precedence over the URI origin (for each metric).
  • Personally, I would prefer the Host header whenever available since it adds the host information back when an IP address is being used in the URI. There is network.peer.address for IP addresses anyways.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions