Micrometer/Prometheus Metric Count

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Micrometer/Prometheus Metric Count

Steve Davids
I have recently migrated to Camel 3.0 (using Spring Boot) and found that
there was a change in behavior for our metrics which drives some dashboards
which shows the number of requests in our primary "process" exchange. The
old code performed a prometheus query which counted the sum of  an earlier
stage's CamelMessageHistory_seconds_count and compared it to the count of
the same metric of the primary "process" stage. Camel 2.x seemed to only
increment the count upon exit of the stage while Camel 3.x seems to
increment the count upon starting the stage. This nuance throws off our
timing graphing and we can't simply choose the "next" component in the
chain because there is global exception handling that might be triggered
from the process which wouldn't allow us to watch a single component "next
in line".

Taking a step back, I would like to find out what the best way to get a
simple count of "in flight" count into Micrometer/Prometheus. Ideally Camel
would provide this functionality natively and would allow me to filter on
the nodeId of the process I'm interested in, but that metric doesn't seem
to be exposed (though it seems to be exposed for other metrics components
<https://issues.apache.org/jira/browse/CAMEL-13977>). I also tried to do:

> .doTry()
>     .toF("micrometer:counter:%s", INFLIGHT_METRIC_NAME)
>     .process(handler)
>     .doFinally()
>         .toF("micrometer:counter:%s?decrement=1", INFLIGHT_METRIC_NAME)
>     .end()
>

But with that configuration my global exception handling breaks for the
`process(handler)` code. Does anyone have suggestions as to how to
accomplish this or if Camel should natively support this use-case?

Thanks,

-Steve
Reply | Threaded
Open this post in threaded view
|

Re: Micrometer/Prometheus Metric Count

Omar Al-Safi
Hi Steve,

in regards to the JIRA issue you added here, it looks like these metrics
are for MicroProfile component (
https://camel.apache.org/components/latest/microprofile-metrics-component.html),
perhaps you can try with microprofile component instead?

Regards,
Omar

On Sat, Jan 18, 2020 at 12:16 AM Steve Davids <[hidden email]> wrote:

> I have recently migrated to Camel 3.0 (using Spring Boot) and found that
> there was a change in behavior for our metrics which drives some dashboards
> which shows the number of requests in our primary "process" exchange. The
> old code performed a prometheus query which counted the sum of  an earlier
> stage's CamelMessageHistory_seconds_count and compared it to the count of
> the same metric of the primary "process" stage. Camel 2.x seemed to only
> increment the count upon exit of the stage while Camel 3.x seems to
> increment the count upon starting the stage. This nuance throws off our
> timing graphing and we can't simply choose the "next" component in the
> chain because there is global exception handling that might be triggered
> from the process which wouldn't allow us to watch a single component "next
> in line".
>
> Taking a step back, I would like to find out what the best way to get a
> simple count of "in flight" count into Micrometer/Prometheus. Ideally Camel
> would provide this functionality natively and would allow me to filter on
> the nodeId of the process I'm interested in, but that metric doesn't seem
> to be exposed (though it seems to be exposed for other metrics components
> <https://issues.apache.org/jira/browse/CAMEL-13977>). I also tried to do:
>
> > .doTry()
> >     .toF("micrometer:counter:%s", INFLIGHT_METRIC_NAME)
> >     .process(handler)
> >     .doFinally()
> >         .toF("micrometer:counter:%s?decrement=1", INFLIGHT_METRIC_NAME)
> >     .end()
> >
>
> But with that configuration my global exception handling breaks for the
> `process(handler)` code. Does anyone have suggestions as to how to
> accomplish this or if Camel should natively support this use-case?
>
> Thanks,
>
> -Steve
>