Document how to customize tags in micrometer-java11 HttpClient instrumentation
#4962 opened on Apr 14, 2024
Description
Currently my company is transitioning to the Quarkus ecosystem, we've found the integration with Micrometer nothing less than amazing. However, we must continue supporting applications that rely on other frameworks and various external SDKs. Our goal is to standardize metrics across these different libraries and frameworks.
Quarkus provides excellent metrics instrumentation for http_client_* using the microprofile-rest-client, as you can see the result below:
# HELP http_client_requests_seconds
# TYPE http_client_requests_seconds summary
http_client_requests_seconds_count{clientName="stage.code.quarkus.io", method="GET", outcome="SUCCESS", status="200", uri="/extensions",} 4.0
http_client_requests_seconds_sum{clientName="stage.code.quarkus.io", method="GET", outcome="SUCCESS", status="200", uri="/extensions",} 0.862757042
# HELP http_client_requests_seconds_max
# TYPE http_client_requests_seconds_max gauge
http_client_requests_seconds_max{clientName="stage.code.quarkus.io", method="GET", outcome="SUCCESS", status="200", uri="/extensions",} 0.525936375
However, using micrometer-java11, the metrics are slightly different, lacking the clientName tag:
# HELP http_client_requests_seconds Timer for JDK's HttpClient
# TYPE http_client_requests_seconds summary
http_client_requests_seconds_count{method="GET", outcome="SUCCESS", status="200", uri="/extensions",} 4.0
http_client_requests_seconds_sum{method="GET", outcome="SUCCESS", status="200", uri="/extensions",} 1.301264958
# HELP http_client_requests_seconds_max Timer for JDK's HttpClient
# TYPE http_client_requests_seconds_max gauge
http_client_requests_seconds_max{method="GET", outcome="SUCCESS", status="200", uri="/extensions",} 0.570812834
Despite exploring the library, I have not found a way to customize micrometer-java11 to mirror the clientName tag functionality. I am aware of the uriMapper capability to customize the uri value.
Here are my questions:
- What approach would you recommend for identifying the client or host in external requests?
- Could custom metrics be a viable solution to this challenge?
- Would you be interested in a pull request that introduces custom tags to micrometer-java11?