You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Dennis Holunder <de...@gmail.com> on 2020/06/18 11:09:42 UTC

micrometer custom metrics not available for scrapping

Hi,

I followed camel-example-micrometer (v2.22.2) and see only jvm metrics
under localhost:8088/metrics
and no metrics from the route direct:bar below. How to make these
available in /metrics output as well?


        from("netty4-http:http://0.0.0.0:8088/metrics")
                .routeId("netty4-http:scrape")
                .log(LoggingLevel.INFO, "Scraping metrics")
                .transform().method(prometheusMeterRegistry, "scrape");

        from("timer:foo?period=1s&fixedRate=true")
                .routeId(TIMER_ROUTE_ID)
                .setHeader("random").exchange(exchange -> random.nextInt(100))
                .log(LoggingLevel.INFO, "Delay is ${header.random}")
                .to("direct:bar");

        from("direct:bar")
                .routeId("direct:bar")
                 .to("micrometer:counter:simple.count?tags=bar=valuebar")
                .to("micrometer:summary:summary?value=${header.random}")
                .to("micrometer:timer:timer?action=start")
                .delay().exchange(exchange -> random.nextInt(100))
                .to("micrometer:timer:timer?action=stop");

Dan

Re: micrometer custom metrics not available for scrapping

Posted by Dennis Holunder <de...@gmail.com>.
Solved. The example was for spring which works and in cdi I solved it
by producing composite registry with added PrometheusMeterRegistry

Am Do., 18. Juni 2020 um 13:10 Uhr schrieb dennisholu [via Camel]
<ml...@n5.nabble.com>:
>
> Hi,
>
> I followed camel-example-micrometer (v2.22.2) and see only jvm metrics
> under localhost:8088/metrics
> and no metrics from the route direct:bar below. How to make these
> available in /metrics output as well?
>
>
>         from("netty4-http:http://0.0.0.0:8088/metrics")
>                 .routeId("netty4-http:scrape")
>                 .log(LoggingLevel.INFO, "Scraping metrics")
>                 .transform().method(prometheusMeterRegistry, "scrape");
>
>         from("timer:foo?period=1s&fixedRate=true")
>                 .routeId(TIMER_ROUTE_ID)
>                 .setHeader("random").exchange(exchange -> random.nextInt(100))
>                 .log(LoggingLevel.INFO, "Delay is ${header.random}")
>                 .to("direct:bar");
>
>         from("direct:bar")
>                 .routeId("direct:bar")
>                  .to("micrometer:counter:simple.count?tags=bar=valuebar")
>                 .to("micrometer:summary:summary?value=${header.random}")
>                 .to("micrometer:timer:timer?action=start")
>                 .delay().exchange(exchange -> random.nextInt(100))
>                 .to("micrometer:timer:timer?action=stop");
>
> Dan
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion below:
> https://camel.465427.n5.nabble.com/micrometer-custom-metrics-not-available-for-scrapping-tp5871807.html
> To unsubscribe from Camel, click here.
> NAML