quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.7k stars 2.66k forks source link

Quarkus Micrometer does not honor vertx WebClientOptions.setMetricName properly #43880

Open sschellh opened 2 hours ago

sschellh commented 2 hours ago

Describe the bug

When creating an io. vertx. mutiny. ext. web. client. WebClient, one can provide a WebClientOptions object. The WebClientOptions allow to set a name and a metric name

        webClientOptions.setMetricsName("my-client-metric");
        webClientOptions.setName("my-client");

However, this name is not used and added as a tag to the exposed Micrometer metrics.

Reason is the logic in io.quarkus.micrometer.runtime.binder.vertx.VertxMeterBinderAdapter#extractClientName The clientName must be prefixed with an arbitrary String followed by a bar (|). Otherwise the name is null.

If one sets the metric name as something|my-client-metric, then the resulting name is my-client-metric.

Expected behavior

webClientOptions.setMetricsName("my-web-client"); 

Setting this option tags the exposed metrics of the webclient with the given name.

Actual behavior

1)

webClientOptions.setMetricsName("my-web-client"); 

The setting is not honored.

2)

webClientOptions.setMetricsName("something|my-web-client"); 

The setting results in a metric name of my-web-client

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

21

Quarkus version or git rev

3.15.1

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 2 hours ago

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