You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vivekt <vi...@gmail.com> on 2015/02/26 00:43:09 UTC
RE: camel-metrics Component
Hello Claus, I tested Jim's orginal Java class with 2.14.1, but still could
not get the metrics from MetricsRegistryService.
When I invoke dumpStatisticsAsJson() , all the metrics are empty.
Here is the output
"version" : "3.0.0",
"gauges" : { },
"counters" : { },
"histograms" : { },
"meters" : { },
"timers" : {
"camel-1:testroute.responses" : {
"count" : 3,
"max" : 25.073,
"mean" : 9.543666666666665,
"min" : 1.5679999999999998,
"p50" : 1.99,
"p75" : 25.073,
"p95" : 25.073,
"p98" : 25.073,
"p99" : 25.073,
"p999" : 25.073,
"stddev" : 13.450452272445464,
"m15_rate" : 0.558194480485237,
"m1_rate" : 0.20307925506404548,
"m5_rate" : 0.48311899441084233,
"mean_rate" : 0.042752986809164464,
"duration_units" : "milliseconds",
"rate_units" : "calls/second"
}
}
}
My application uses blueprint and I want to expose the counters so that I
can access the metrics via Hawtio
In blueprint.xml, I have declared the bean as
<bean id="metricsRoutePolicyFactory"
class="org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory">
<property name="useJmx" value="true"/>
<property name="prettyPrint" value="true"/>
</bean>
In Hawtio interface, I do see the Mbean service but it does not have any
counters in the output.
Could you please let me know if the issue is fixed in 2.14.1?
Is there something that I am missing?
Thanks,
Vivek
--
View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763182.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-metrics Component
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Ah in blueprint its easier just declare a <bean> with
id="metricsRegistry" and its shared, eg.
<bean id="metricsRegistry" class="com.codahale.metrics.MetricsRegistry"/>
its the name metricsRegistry that has a special meaning
On Mon, Mar 2, 2015 at 8:20 AM, vivekt <vi...@gmail.com> wrote:
> Hello Claus,
>
> Thank you again for your reply. The code in java works and I can get the
> counter metrics values in MetricRegistry.
>
> I am now trying to figure out how can I create a bean in blueprint of
> SimpleRegistry which extends type HashMap.
> So far, I have this.
>
> <bean id="metricsRegistry" class="com.codahale.metrics.MetricsRegistry"/>
> <bean id="simpleRegistry" class="org.apache.camel.impl.SimpleRegistry">
> <entry key="metricsRegistry" value-ref = "metricsRegistry" />
> </bean>
>
> Also, I am not sure how can I instantiate DefaultCamelContext and set
> SimpleRegistry in the constructor within blueprint (or even spring)
>
> It would be great if you can suggest the way to do it.
>
> Thanks,
>
> Vivek
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763357.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: camel-metrics Component
Posted by vivekt <vi...@gmail.com>.
Hello Claus,
Thank you again for your reply. The code in java works and I can get the
counter metrics values in MetricRegistry.
I am now trying to figure out how can I create a bean in blueprint of
SimpleRegistry which extends type HashMap.
So far, I have this.
<bean id="metricsRegistry" class="com.codahale.metrics.MetricsRegistry"/>
<bean id="simpleRegistry" class="org.apache.camel.impl.SimpleRegistry">
<entry key="metricsRegistry" value-ref = "metricsRegistry" />
</bean>
Also, I am not sure how can I instantiate DefaultCamelContext and set
SimpleRegistry in the constructor within blueprint (or even spring)
It would be great if you can suggest the way to do it.
Thanks,
Vivek
--
View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763357.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-metrics Component
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Setup a shared metrics registry with the name metricRegistry, then its shared.
If using java, then
SimpleRegistry map = new SimpleRegistry();
map.put("metricsRegistry, new MetricRegistry());
CamelContext context = new DefaultCamelContext(map);
On Sat, Feb 28, 2015 at 8:28 AM, vivekt <vi...@gmail.com> wrote:
> I am using metrics component of type counter in camel route. I do see the
> counters and their values reported in the logs every 1 minute, but I want to
> access these values via jmx so that I can push them to our dashboard.
>
> Here is the chunk of log file...
>
> 2015-02-26 17:23:49,948 | INFO | eporter-thread-1 | MetricsComponent
> | 99 - org.apache.camel.camel-metrics - 2.14.1 | type=COUNTER,
> name=message.good.counts, count=4
> 2015-02-26 17:23:49,948 | INFO | eporter-thread-1 | MetricsComponent
> | 99 - org.apache.camel.camel-metrics - 2.14.1 | type=COUNTER,
> name=message.incoming.counts, count=4
>
> I was hoping that since I am using MetricsRoutePolicy in my
> blueprintContext, these counters (and their values) will be reported and are
> accessible via MBean : MetricRegistryService. When I invoke the operation
> dumpStatisticsAsJson(), only timer metrics has values in json, and no
> counters are listed.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763280.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: camel-metrics Component
Posted by vivekt <vi...@gmail.com>.
I am using metrics component of type counter in camel route. I do see the
counters and their values reported in the logs every 1 minute, but I want to
access these values via jmx so that I can push them to our dashboard.
Here is the chunk of log file...
2015-02-26 17:23:49,948 | INFO | eporter-thread-1 | MetricsComponent
| 99 - org.apache.camel.camel-metrics - 2.14.1 | type=COUNTER,
name=message.good.counts, count=4
2015-02-26 17:23:49,948 | INFO | eporter-thread-1 | MetricsComponent
| 99 - org.apache.camel.camel-metrics - 2.14.1 | type=COUNTER,
name=message.incoming.counts, count=4
I was hoping that since I am using MetricsRoutePolicy in my
blueprintContext, these counters (and their values) will be reported and are
accessible via MBean : MetricRegistryService. When I invoke the operation
dumpStatisticsAsJson(), only timer metrics has values in json, and no
counters are listed.
--
View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763280.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-metrics Component
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
What counters are you talking about?
On Thu, Feb 26, 2015 at 7:34 PM, vivekt <vi...@gmail.com> wrote:
> Hello Claus,
>
> Thank you for your quick reply.
> I do see that the metrics route policy is using a metrics timer to capture
> the data.
> But it does not have the counters values which I am using in the blueprint
> context.
>
> Do I have to write my own MetricsRoutePolicy (or extend it) so that all the
> counters are captured?
>
> Thanks,
>
> Vivek
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763236.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: camel-metrics Component
Posted by vivekt <vi...@gmail.com>.
Hello Claus,
Thank you for your quick reply.
I do see that the metrics route policy is using a metrics timer to capture
the data.
But it does not have the counters values which I am using in the blueprint
context.
Do I have to write my own MetricsRoutePolicy (or extend it) so that all the
counters are captured?
Thanks,
Vivek
--
View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763236.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-metrics Component
Posted by Claus Ibsen <cl...@gmail.com>.
The metrics route policy is using a metrics timer to capture the data.
So the data is there in the json blob you posted.
https://github.com/apache/camel/blob/master/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java#L46
On Thu, Feb 26, 2015 at 12:43 AM, vivekt <vi...@gmail.com> wrote:
> Hello Claus, I tested Jim's orginal Java class with 2.14.1, but still could
> not get the metrics from MetricsRegistryService.
>
> When I invoke dumpStatisticsAsJson() , all the metrics are empty.
> Here is the output
>
> "version" : "3.0.0",
> "gauges" : { },
> "counters" : { },
> "histograms" : { },
> "meters" : { },
> "timers" : {
> "camel-1:testroute.responses" : {
> "count" : 3,
> "max" : 25.073,
> "mean" : 9.543666666666665,
> "min" : 1.5679999999999998,
> "p50" : 1.99,
> "p75" : 25.073,
> "p95" : 25.073,
> "p98" : 25.073,
> "p99" : 25.073,
> "p999" : 25.073,
> "stddev" : 13.450452272445464,
> "m15_rate" : 0.558194480485237,
> "m1_rate" : 0.20307925506404548,
> "m5_rate" : 0.48311899441084233,
> "mean_rate" : 0.042752986809164464,
> "duration_units" : "milliseconds",
> "rate_units" : "calls/second"
> }
> }
> }
>
> My application uses blueprint and I want to expose the counters so that I
> can access the metrics via Hawtio
>
> In blueprint.xml, I have declared the bean as
>
> <bean id="metricsRoutePolicyFactory"
> class="org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory">
> <property name="useJmx" value="true"/>
> <property name="prettyPrint" value="true"/>
> </bean>
>
> In Hawtio interface, I do see the Mbean service but it does not have any
> counters in the output.
>
> Could you please let me know if the issue is fixed in 2.14.1?
> Is there something that I am missing?
>
> Thanks,
>
> Vivek
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-metrics-Component-tp5758627p5763182.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/