Skip to content

Should the server.address tag in the HttpClient metric counters incorporate the Host header of the request? #117049

@Tragetaschen

Description

@Tragetaschen

The MetricsHandler of the HttpClient currently sets the server.address tag and extracts the value from the request's URL. On the other hand, requests can explicitly set the Host header to overwrite the hostname information from the one in the given URL.

When using client-side load balancing in https://github.com/grpc/grpc-dotnet, the implementation does DNS lookups for the given hostname and then constructs IP-URLs that are the input for multiple round-robin http requests. These are configured to overwrite the Host header with the original hostname.

When looking at the exported metrics in that scenario, there is basically no way to recognize from the counters which gRPC service was actually contacted. Especially in a k8s cluster, the information which service had the IP might even be long gone.

By incorporating the overwritten Host header of the HttpRequest when generating the tag, that information could be retained.

Alternatively, an additional (non-standard?) tag might help as well.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions