Repository navigation
[client-v2] Measure connection establishment time - #3353
Open
utkarshb1209 wants to merge 1 commit into
Open
utkarshb1209 wants to merge 1 commit into
utkarshb1209 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes httpcomponents.httpclient.connect.time in client-v2.
Previously, the metric measured connection object creation time rather than actual connection establishment time.
This change moves timing to the HTTP client connection operator and measures the duration of the connection operation, including DNS resolution, TCP connection, and TLS handshake for new direct connections.
Additional changes:
Uses System.nanoTime() to retain sub-millisecond precision.
Reports the average connection establishment time in milliseconds.
Does not record additional samples when an existing pooled connection is reused.
Updates the connection metrics documentation and changelog.
Closes #3254
Note
Low Risk
Observability-only change to how connect timing is sampled and exposed; no query, auth, or transport behavior changes beyond metric accuracy.
Overview
Fixes
httpcomponents.httpclient.connect.timeso it measures real connection establishment (via a newMeteredHttpClientConnectionOperatoraround Apache HttpClient’s connect path), not time spent wrapping an already-connected socket inMeteredManagedHttpClientConnectionFactory.The pooled connection manager builder now installs that operator; samples use
System.nanoTime(), are averaged in milliseconds for Micrometer, and are not recorded when metrics are off or when a pooled connection is reused. Tests cover delayed TCP/TLS, end-to-end client metrics (HTTP/HTTPS), and the integrationtestConnectionTimecase is re-enabled.Reviewed by Cursor Bugbot for commit a052634. Bugbot is set up for automated code reviews on this repo. Configure here.