-
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
Apache HTTP client instrumentation #533
Comments
Add metrics for:
Apply these on custom Feedback suggests that DNS resolution/SSL handshake can go up dramatically in noisy neighbor situations. |
Would be great to also have metrics for monitoring the connection pools of When enabling |
Just want to inform you, that we have a solution for monitoring the connection pools here at @willhaben. I'll contribute it as soon as we tested it with one of our applications. |
@benhubert How it's going with the testing of pool monitoring? I would like to use for one of our app in case it can be made available. |
@ravin-singh Sorry. We are working on some other big changes at the moment, which are causing delays for this particular task. But it looks like we are able to continue with this next week, so I should be able to prepare the pull request soon. |
Thanks @benhubert. For mean time I have created a workaround solution that exposed pool stats to micrometer. |
…crometer-metrics#533 To avoid problems with the thread pool (i.e. if `@PreDestroy` is not called at shutdown) I removed the thread pool.
) Provides metrics for the underlying connection pool total stats. See #533
With the merged pull requests, I'm considering this enhancement request complete. There is now I've opened up follow-up issues to track other ideas for metrics for Apache HttpClient. See #1616 and #1617. |
Thank you for your contribution! I just wonder how I may use try {
Class<?> internalHttpClient = Class.forName("org.apache.http.impl.client.InternalHttpClient"); // HttpClientBuilder returns InternalHttpClient which is an internal implementation of CloseableHttpClient
Field connManagerField = internalHttpClient.getDeclaredField("connManager");
connManagerField.setAccessible(true);
PoolingHttpClientConnectionManager connManager = (PoolingHttpClientConnectionManager) connManagerField.get(client);
new PoolingHttpClientConnectionManagerMetricsBinder(connManager, "proxyHttpClient").bindTo(meterRegistry);
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
// some error handling here
} |
@j-gurda usage questions like this can easily be lost on closed issues (especially old, closed issues). StackOverflow or our Slack channel are a better place for such questions. You can make your own PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build();
new PoolingHttpClientConnectionManagerMetricsBinder(connectionManager, "my-pool").bindTo(registry); |
It looks like there is already OkHttp instrumentation (which isn't documented as far as I can tell). It would be nice if there were also instrumentation for the Apache HTTP client. This would help achieve HTTP client instrumentation in cases where people are using the HTTP client directly (instead of through
RestTemplate
in a Spring application) or for things like the Elasticsearch Java Low Level REST.The text was updated successfully, but these errors were encountered: