Skip to content

Conversation

@vietj
Copy link
Member

@vietj vietj commented Dec 5, 2025

Motivation:

The ClientMetrics SPI should give the opportunity to frameworks building on top of Vert.x HTTP client to customize the request metric before headers are written.

Changes:

  • Extend ClientMetrics with new methods that decouple request metric create (init) and request headers write signal (requestBegin)
  • Provide a HttpClientRequestInternal extension that exposes the request metric instance

…d by the HTTP client before the request is actually sent.

Motivation:

The ClientMetrics SPI design creates a request metric when the request headers are written, we should actually relax this constraint and let client obtain a metric from the SPI before headers are written, in order to give the oppportunity to customize the request metric object before headers are written.

Changes:

Extend ClientMetrics SPI to add a new init method that produces a metrics instance.

When the implementation returns null, the client behaves with a compatibility mode and calls ClientMetrics#requestBegin to signal the beginning of the request and obtain the request metric.

When the implementation returns non-null, the client instead calls the ClientMetrics#requestBegin overload that accepts the request metric instance that should be handed back to the SPI.
@vietj vietj added this to the 4.5.23 milestone Dec 5, 2025
@vietj
Copy link
Member Author

vietj commented Dec 5, 2025

@geoand this is the backport to 4.x

@geoand
Copy link
Contributor

geoand commented Dec 5, 2025

Thanks a lot! I'll test it on Monday

…quest metric.

Motivation:

Sometimes it is necessary to let framework access to underlying metric of an HTTP request in order to reliably and efficiently share state with the metrics implementation.

This is useful for frameworks that build on top of HTTP client and wants to extend metrics reporting beyond Vert.x capabitilies.
@vietj vietj force-pushed the client-metrics-lifecycle-4.x branch from c4b70eb to acb53cd Compare December 9, 2025 13:23
@vietj vietj merged commit 1589c03 into 4.x Dec 9, 2025
10 of 13 checks passed
@vietj vietj deleted the client-metrics-lifecycle-4.x branch December 9, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants