Max created CAMEL-19136:
---------------------------
Summary: Too many tags created by micrometer WebMvcTagsProvider
Key: CAMEL-19136
URL: https://issues.apache.org/jira/browse/CAMEL-19136
Project: Camel
Issue Type: Bug
Components: camel-micrometer
Affects Versions: 3.20.2, 3.20.1, 3.20.0
Reporter: Max
>From discussion in zulip
>[https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/springboot.20micrometer.20http.20metrics.20issue/near/340948367]
in https://issues.apache.org/jira/browse/CAMEL-18754
https://github.com/apache/camel-spring-boot/commit/ac318f0418e55c56d0fb426607c67a5ceb1f6742
new configuration has been introduced {{MicrometerTagsAutoConfiguration}}.
Request {{uri}} with placeholders in the metrics tag is replaced with actual
value e.g.
{code}
@RequestMapping(value = "/users/{id}" method = RequestMethod.GET)
{code}
instead of
{code}
http_server_requests_seconds_bucket{application="my-app",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/users/{id}",le="0.894784851",}
9999.0
{code}
is reported as
{code}
http_server_requests_seconds_bucket{application="my-app",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/users/1",le="0.894784851",}
1.0
http_server_requests_seconds_bucket{application="my-app",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/users/2",le="0.894784851",}
1.0
http_server_requests_seconds_bucket{application="my-app",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/users/3",le="0.894784851",}
1.0
http_server_requests_seconds_bucket{application="my-app",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/users/999999",le="0.894784851",}
1.0
{code}
and of course will end up a lot of tags which is bad for prometheus.
and spring reports warning
{code}
logger_name
org.springframework.boot.actuate.autoconfigure.metrics.OnlyOnceLoggingDenyMeterFilter
message Reached the maximum number of URI tags for 'http.server.requests'.
How can we preserve original uri tag? We combine camel with spring boot, so
rest api layer is provided by spring boot but integration layer (messaging,
http client etc.. ) is done by camel, so would love to keep camel route stats
but keep spring boot reported metrics
{code}
basically
{code}
@Bean
WebMvcTagsProvider webMvcTagsProvider() {
....
return Tags.concat(
super.getTags(request, response, handler, exception),
Tags.of(Tag.of("uri", uri))
);
{code}
makes out of {{/users/\{id\}}} -> {{/users/1}}
by excluding
{code}
@SpringBootApplication(exclude = {MicrometerTagsAutoConfiguration.class})
{code}
we get the original behavior. But the risk is that if future versions add more
beans into MicrometerTagsAutoConfiguration they will be ignored
How can we preserve original uri tag or make it configurable?
may be regex/whitelist/blacklist on which it should apply?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)