-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to give custom metric name to MicrometerHttpRequestExecutor #3706
Comments
Since okhttp has it I think it would make sense to add it to this one too. Are you up to filing a PR for this? In the meantime: you can customize any new MeterFilter() {
@Override
public Meter.Id map(Meter.Id id) {
if (id.getName().equals("httpcomponents.httpclient.request")) {
return id.withName("http.client.requests");
}
return id;
}
} See the docs: https://micrometer.io/docs/concepts#_transforming_metrics |
@jonatan-ivanov Sure, you can assign this issue to me. I will work on a PR to resolve it. |
Hi @jonatan-ivanov , Should I create PR against Also is it fine to implement a similar capability in |
Yes, since this is a new functionality (it's not really a bug: a
I've just took a deeper look and it seems
@shakuzen What do you think? |
…equests that goes through HttpClient and HttpAsyncClient Resolved micrometer-metricsgh-3706
# Conflicts: # micrometer-core/src/main/java/io/micrometer/core/instrument/binder/httpcomponents/MicrometerHttpRequestExecutor.java # micrometer-core/src/main/java/io/micrometer/core/instrument/binder/httpcomponents/hc5/MicrometerHttpRequestExecutor.java
Exactly what I was looking for. Is there a chance the PR will make it into 1.11? |
Just a note to other people investigating how to combine different instrumentations under a unified metric name: The suggested |
Sorry for the gigantic delay, we are refining our backlog and will do our best to give some feedback on the PR and this issue ASAP |
the PR linked to this issue targets the now depreciated The current implementation could be customized, albeit not very user-friendly. On order to use a custom metric,
I'm happy to come up with a PR providing a more easily customizable solution. Is there a best practice / convention on how to implement customizable |
Actually what you did with the observation conventions is exactly what we suggest. You can read about that in the docs. |
Ok. I asked because there are still Would It be feasible to have a |
Ah ok - yes, I understand now, IMO it makes sense, WDYT @shakuzen @jonatan-ivanov ? |
Please describe the feature request.
Currently the metric name for
MicrometerHttpRequestExecutor
is fixed tohttpcomponents.httpclient.request
, requesting to provide a way to give custom metric name like we have such option inOkHttpMetricsEventListener
Rationale
We have different libraries which use different HTTP client libraries to make API calls i.e
RestTemplate
,OkHttp
andHttpClient
Now we want to make sure that all the metrics generated by all these three clients are reported with same metric name. I know we can customize spring-boot's
RestTemplate
andOkHttp
client metric name tohttpcomponents.httpclient.request
so that all metrics are reported underhttpcomponents.httpclient.request
but we like to name the metric ashttp.client.requests
so need an option to provide custom metric name toMicrometerHttpRequestExecutor
Additional context
The text was updated successfully, but these errors were encountered: