Closed ben-r closed 2 years ago
Here is the micrometer metrics autoconfiguration that should fit you
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(name = "io.micrometer.core.instrument.MeterRegistry")
@ConditionalOnProperty(name = "reactive.feign.metrics.enabled", havingValue = "true")
public MicrometerReactiveLogger metricsReactiveLogger() {
return MicrometerReactiveLogger.basicTimer();
}
Check MicrometerReactiveLogger
and MetricsTag
for available tags
Feel free to reopen issue if we need to tune MicrometerReactiveLogger
Client metrics are recorded based on expanded URI templates which creates a new time series for every new value encountered (cardinality explosion), which is harmful for time series based databases like Prometheus.
Example
should produce a metric like
http_client_requests_seconds_count{uri="/api/test/{id}/response}
Instead it produces
http_client_requests_seconds_count{uri="/api/test/1/response?param=hello}
which makes it impossible to group metrics for this endpoint.
I didn't dig deeper into the code, but I'm pretty sure it goes into the same direction as this PR in the OpenFeign project: https://github.com/OpenFeign/feign/pull/1493
The recommended way to build the request to achieve correct metrics looks like this
You can find a sample project showcasing the issue here: https://github.com/ben-r/reactive-feign-metrics-example