You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Roberto Camelk <be...@gmail.com> on 2021/12/01 17:08:39 UTC

Question about camel metrics IDs

I found a prometheus yaml config, who's using some scrape definitions
and I need to find the correlated metrics in camel-k.

Here are the scrape patterns:
https://github.com/alainpham/app-archetypes/blob/1f559e84753525b087a503ecb2d97c26e108dee7/spring-boot-camel/src/main/resources/archetype-resources/src/main/fabric8-includes/prometheus-config.yml

They have some expressions like:
- pattern: 'org.apache.camel<context=([^,]+), type=context,
name=([^,]+)><>ExchangesCompleted'

I think this one is about the
"camel.context.exchanges.completed.total" listed here
https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html#_camel_route_metrics.

Can someone help me with this? How can I correlate this
"org.apache.camel..." to this default exposed metrics ids in
camel-quarkus-microprofile-metrics ?

Re: Question about camel metrics IDs

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Roberto,

There is no link between microprofile and JMX but you can register any JMX
metric in microprofile-metrics programmatically (you can have a look to
https://github.com/apache/geronimo-metrics/blob/33ca63305677c0c62c975f7d76ed1a314d9382e2/geronimo-metrics-common/src/main/java/org/apache/geronimo/microprofile/metrics/common/BaseMetrics.java#L48)
so theorically it is possible to forward them all at camel context
initialization - not sure it is desired but doable (note that depending
your version of microprofile this code can work directly or not since the
API is broken with almost all release so can need some tuning).
The side note is that all the metrics are available elsewhere (generally
from the management module or camel context) so it can be faster to just
read them from where they are instead of using JMX as a bridge.

Hope it helps.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le mer. 1 déc. 2021 à 20:05, Roberto Camelk <be...@gmail.com>
a écrit :

> OK, thanks! But it is a little tricky for me...
>
> Is there no correlation possibility between the JMX metrics and the
> Microprofile Metrics at all?
>
> A challenge, try adapt this grafana dashboard based on JMX metrics:
>
> https://github.com/weimeilin79/camel-k-example-prometheus/blob/master/grafana/SampleCamelDashboard.json
> To use Microprofile Metrics...???
>

Re: Question about camel metrics IDs

Posted by Roberto Camelk <be...@gmail.com>.
OK, thanks! But it is a little tricky for me...

Is there no correlation possibility between the JMX metrics and the
Microprofile Metrics at all?

A challenge, try adapt this grafana dashboard based on JMX metrics:
https://github.com/weimeilin79/camel-k-example-prometheus/blob/master/grafana/SampleCamelDashboard.json
To use Microprofile Metrics...???

Re: Question about camel metrics IDs

Posted by Antonin Stefanutti <an...@stefanutti.fr.INVALID>.
> On 1 Dec 2021, at 18:58, Roberto Camelk <be...@gmail.com> wrote:
> 
> OK, thanks.
> 
> But, can I setup the JMX exported in a Camel-K integration?

It's a bit tricky but not impossible. You would need to replicate what we did before we moved to Quarkus as the runtime, that is:

Add the dependencies on camel-management and jmx_prometheus_javaagent:

https://github.com/apache/camel-k/blob/75cdfa0c4d71fe3022fdaff7d39585875509beb7/pkg/trait/prometheus.go#L93-L96

Mount the ConfigMap containing the Prometheus JMX exporter configuration:

https://github.com/apache/camel-k/blob/75cdfa0c4d71fe3022fdaff7d39585875509beb7/pkg/trait/prometheus.go#L99-L108

And finally add the Prometheus JMX exporter agent:

https://github.com/apache/camel-k/blob/75cdfa0c4d71fe3022fdaff7d39585875509beb7/pkg/trait/prometheus.go#L138

The later can possibly be done by using the options parameter of the jvm trait.

> On Wed, Dec 1, 2021 at 2:39 PM Antonin Stefanutti
> <an...@stefanutti.fr.invalid> wrote:
>> 
>> 
>> 
>> On 1 Dec 2021, at 18:08, Roberto Camelk <be...@gmail.com>> wrote:
>> 
>> I found a prometheus yaml config, who's using some scrape definitions
>> and I need to find the correlated metrics in camel-k.
>> 
>> Here are the scrape patterns:
>> https://github.com/alainpham/app-archetypes/blob/1f559e84753525b087a503ecb2d97c26e108dee7/spring-boot-camel/src/main/resources/archetype-resources/src/main/fabric8-includes/prometheus-config.yml
>> 
>> They have some expressions like:
>> - pattern: 'org.apache.camel<context=([^,]+), type=context,
>> name=([^,]+)><>ExchangesCompleted'
>> 
>> I think this one is about the
>> "camel.context.exchanges.completed.total" listed here
>> https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html#_camel_route_metrics.
>> 
>> That file is used for the Prometheus JMX exporter and does not apply to the Camel Quarkus MicroProfile Metrics extension.
>> 
>> Can someone help me with this? How can I correlate this
>> "org.apache.camel..." to this default exposed metrics ids in
>> camel-quarkus-microprofile-metrics ?
>> 
>> The list of metrics registered is defined by the Camel Quarkus MicroProfile Metrics extension, and is documented here:
>> 
>> https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html
>> 
>> Then the names are mapped according to the MP Metrics specification:
>> 
>> https://download.eclipse.org/microprofile/microprofile-metrics-4.0/microprofile-metrics-spec-4.0.html
>> 
>> That is, a the "application" prefix, and the snake cased metric name.
>> 


Re: Question about camel metrics IDs

Posted by Roberto Camelk <be...@gmail.com>.
OK, thanks.

But, can I setup the JMX exported in a Camel-K integration?

On Wed, Dec 1, 2021 at 2:39 PM Antonin Stefanutti
<an...@stefanutti.fr.invalid> wrote:
>
>
>
> On 1 Dec 2021, at 18:08, Roberto Camelk <be...@gmail.com>> wrote:
>
> I found a prometheus yaml config, who's using some scrape definitions
> and I need to find the correlated metrics in camel-k.
>
> Here are the scrape patterns:
> https://github.com/alainpham/app-archetypes/blob/1f559e84753525b087a503ecb2d97c26e108dee7/spring-boot-camel/src/main/resources/archetype-resources/src/main/fabric8-includes/prometheus-config.yml
>
> They have some expressions like:
> - pattern: 'org.apache.camel<context=([^,]+), type=context,
> name=([^,]+)><>ExchangesCompleted'
>
> I think this one is about the
> "camel.context.exchanges.completed.total" listed here
> https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html#_camel_route_metrics.
>
> That file is used for the Prometheus JMX exporter and does not apply to the Camel Quarkus MicroProfile Metrics extension.
>
> Can someone help me with this? How can I correlate this
> "org.apache.camel..." to this default exposed metrics ids in
> camel-quarkus-microprofile-metrics ?
>
> The list of metrics registered is defined by the Camel Quarkus MicroProfile Metrics extension, and is documented here:
>
> https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html
>
> Then the names are mapped according to the MP Metrics specification:
>
> https://download.eclipse.org/microprofile/microprofile-metrics-4.0/microprofile-metrics-spec-4.0.html
>
> That is, a the "application" prefix, and the snake cased metric name.
>

Re: Question about camel metrics IDs

Posted by Antonin Stefanutti <an...@stefanutti.fr.INVALID>.

On 1 Dec 2021, at 18:08, Roberto Camelk <be...@gmail.com>> wrote:

I found a prometheus yaml config, who's using some scrape definitions
and I need to find the correlated metrics in camel-k.

Here are the scrape patterns:
https://github.com/alainpham/app-archetypes/blob/1f559e84753525b087a503ecb2d97c26e108dee7/spring-boot-camel/src/main/resources/archetype-resources/src/main/fabric8-includes/prometheus-config.yml

They have some expressions like:
- pattern: 'org.apache.camel<context=([^,]+), type=context,
name=([^,]+)><>ExchangesCompleted'

I think this one is about the
"camel.context.exchanges.completed.total" listed here
https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html#_camel_route_metrics.

That file is used for the Prometheus JMX exporter and does not apply to the Camel Quarkus MicroProfile Metrics extension.

Can someone help me with this? How can I correlate this
"org.apache.camel..." to this default exposed metrics ids in
camel-quarkus-microprofile-metrics ?

The list of metrics registered is defined by the Camel Quarkus MicroProfile Metrics extension, and is documented here:

https://camel.apache.org/camel-quarkus/2.5.x/reference/extensions/microprofile-metrics.html

Then the names are mapped according to the MP Metrics specification:

https://download.eclipse.org/microprofile/microprofile-metrics-4.0/microprofile-metrics-spec-4.0.html

That is, a the "application" prefix, and the snake cased metric name.