Ritesh Bhat
Ritesh Bhat

Reputation: 976

how to add micrometer tags to webClient in spring

So I am collecting a metric like this http_client_requests_seconds_count{clientname="www.exmaple.com", uri="/users/somethihng/1233"} from my spring application using micrometer and exposing it to prometheus.

Now i didnt configured any of these metric's label/tags, this is provided by default with webClient metrics. Now 10s of such http_client metrics from my appliction are being collected but I want to add some specific tags to a particular webClient call (FYI: I have a separate webClient instance for making this call).

How can I add tags to metrics which is being collected from this one webClient ? I have come across WebFluxTagsProvider and RouterFunctionMetrics but couldnt find appropriate code examples.

Also, i know how to add global common tags, question is about adding tags for a specific webClient calls.

Would really appreciate the help. Also, if you ned clarity on the question please post a comment.

Upvotes: 0

Views: 1066

Answers (1)

Borislav Stoilov
Borislav Stoilov

Reputation: 3697

Try using MetricsWebClientCustomizer, it is provided when WebClient is build

Upvotes: 0

Related Questions