You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by SaurabhNayar <Na...@gmail.com> on 2016/09/06 21:01:30 UTC

Camel Metrics

I have incorporated Camel Statistics in my project. And they are awesome. I
am trying to capture custom statistics for idempotent Consumer component
like below:                .to("metrics:timer:idempotentTimer?action=start")               
.idempotentConsumer(simple("${body.id}"), jdbcMessageIdRepository)               
.to("metrics:timer:idempotentTimer?action=stop")For some reason, I am not
able to get the metrics idempotentTimer from the following code:       
MetricsRegistryService metricsRegistry =
context.hasService(MetricsRegistryService.class);        if(metricsRegistry
!= null) {            return metricsRegistry.dumpStatisticsAsJson();       
}Or from         MetricsMessageHistoryService metricsRegistry =
context.hasService(MetricsMessageHistoryService.class);       
if(metricsRegistry != null) {            return
metricsRegistry.dumpStatisticsAsJson();        }Any ideas.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Metrics-tp5787256.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Metrics

Posted by Willem Jiang <wi...@gmail.com>.
How about using the below code to look up the MetricsRegistry :)

context.getRegistry().lookupByNameAndType(“metricRegistry”, MetricRegistry.class);

--  
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)  
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 7, 2016 at 5:01:35 AM, SaurabhNayar (nayar.saurabh@gmail.com) wrote:
> I have incorporated Camel Statistics in my project. And they are awesome. I
> am trying to capture custom statistics for idempotent Consumer component
> like below: .to("metrics:timer:idempotentTimer?action=start")
> .idempotentConsumer(simple("${body.id}"), jdbcMessageIdRepository)
> .to("metrics:timer:idempotentTimer?action=stop")For some reason, I am not
> able to get the metrics idempotentTimer from the following code:
> MetricsRegistryService metricsRegistry =
> context.hasService(MetricsRegistryService.class); if(metricsRegistry
> != null) { return metricsRegistry.dumpStatisticsAsJson();
> }Or from MetricsMessageHistoryService metricsRegistry =
> context.hasService(MetricsMessageHistoryService.class);
> if(metricsRegistry != null) { return
> metricsRegistry.dumpStatisticsAsJson(); }Any ideas.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Metrics-tp5787256.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.