Skip to content

Conversation

i-m-addycoder
Copy link
Contributor

@i-m-addycoder i-m-addycoder commented Apr 25, 2025

Add new HTTP Server http_server_active_connections and Client http_client_active_connections gauge metrics.

The client metric will be available (just like many other such client metrics) only when the client is registered with metrics name programmatically as below:

var httpClientOptions = new HttpClientOptions().setMetricsName("|localhost"); // IMPORTANT!
        
externalService = QuarkusRestClientBuilder.newBuilder()
    .baseUri(URI.create("http://localhost:8081"))
    .httpClientOptions(httpClientOptions) // IMPORTANT!
    .build(ExternalService.class);

where ExternalService is a Rest Client interface.

Another approach: I couldn't find a way to register the metrics name through annotations, so using @RestClient annotation will not register this metric along with some other metrics which fall into the same category unless ContextResolver for HttpClientOptions is registered as given here .

Copy link

quarkus-bot bot commented Apr 25, 2025

/cc @brunobat (micrometer), @ebullient (micrometer)

@gsmet gsmet requested a review from brunobat April 28, 2025 08:34
Copy link
Contributor

@brunobat brunobat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @i-m-addycoder we need tests for this feature.
Please check

@i-m-addycoder
Copy link
Contributor Author

Apologies @brunobat for missing the tests. Added assertions to the test class :)

@geoand geoand requested a review from brunobat April 29, 2025 10:31
Copy link

quarkus-bot bot commented Apr 29, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 55e9fc9.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17 Windows

📦 extensions/micrometer-opentelemetry/deployment

io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod_LongTaskTimer_Uni - History

  • expected: <0> but was: <1> - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: expected: <0> but was: <1>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:632)
	at io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod_LongTaskTimer_Uni(MicrometerTimedInterceptorTest.java:267)

Copy link
Contributor

@brunobat brunobat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used it and seems good to go.

@brunobat brunobat merged commit f0edda4 into quarkusio:main May 6, 2025
34 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.23 - main milestone May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants