Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19136

camel-micrometer - Too many tags created by micrometer WebMvcTagsProvider

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      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.

       @RequestMapping(value = "/users/{id}" method = RequestMethod.GET)
      

      instead of

      http_server_requests_seconds_bucket{application="my-app",exception="None",method="GET",outcome="SUCCESS",status="200",uri="/users/{id}",le="0.894784851",} 9999.0
      

      is reported as

      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
      

      and of course will end up a lot of tags which is bad for prometheus.

      and spring reports warning

      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
      

      basically

      @Bean
          WebMvcTagsProvider webMvcTagsProvider() {
      ....
      return Tags.concat(
                              super.getTags(request, response, handler, exception),
                              Tags.of(Tag.of("uri", uri))
                      );
      

      makes out of /users/{id} -> /users/1
      by excluding

      @SpringBootApplication(exclude = {MicrometerTagsAutoConfiguration.class}) 
      

      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? 

       

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              Mustermann Max
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: