camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Metrics Component generating info messages
Date Tue, 03 Mar 2015 05:48:25 GMT

In the upcoming Camel 2.15 it logs at debug level and you can set the
metrics registry on the component using a setter.

On Tue, Mar 3, 2015 at 12:17 AM, Derek Bassett
<> wrote:
> Hi,
> I want to start off by thanking everyone for all the community support for this product.
> We recently upgraded to Camel 2.14.2 and just started using the camel-metrics component
inside our Camel Route file.
> We use the following command to measure http request times using coda hale metrics library.
> <recipientList>
>         <simple>metrics:timer:${camelId}:${routeId}.http?action=start</simple>
> </recipientList>
> <to id="call HTTP endpoint" uri=“{{http.endpoint.uri}}”/>
> <recipientList>
> <simple>metrics:timer:${camelId}:${routeId}.http?action=stop</simple>
> </recipientList>
> I do this so I can use the camelId and routeId in the name of the metrics timer object
I am trying to create.
> This works fine and generates the information I want to generate but leads to an interesting
side effect.
> Inside the MetricsComponent:
> @Override
> protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object>
parameters) throws Exception {
>     if (metricRegistry == null) {
>         Registry camelRegistry = getCamelContext().getRegistry();
>         metricRegistry = getOrCreateMetricRegistry(camelRegistry, METRIC_REGISTRY_NAME);
>     }
>     String metricsName = getMetricsName(remaining);
>     MetricsType metricsType = getMetricsType(remaining);
>"Metrics type: {}; name: {}", metricsType, metricsName);
>     Endpoint endpoint = createNewEndpoint(metricRegistry, metricsType, metricsName);
>     setProperties(endpoint, parameters);
>     return endpoint;
> }
> You have"Metrics type: {}; name: {}", metricsType, metricsName); which means
every time I call recipientList it generates a log message.  Generating an INFO log message
every time I log metrics is not optimal but I can live with it.
> Am I doing this in the most efficient way possible given I want to set the timer name
based on the CamelId and RouteId?
> Is there a simple way to avoid generating the message, obviously I can turn
off logging for org.apache.camel.component.metrics.MetricsComponent but I wondered if there
was a way to cache the endpoint so it was not created each time?
> The other issue I would like to see with the current Metrics Component is I can only
use the MetricRegistry named “metricRegistry."  I would like to be able to configure the
Component as a bean, like I do with other Component and set the metricRegistry object of my
choice.  I wondered if there was any technical reason why this could not be made configurable?
> Thank you
> Derek
> Derek Bassett  |  Senior Software Engineer
> 1444 Wazee Street, Suite 310
> Denver, CO 80202
> Watch where we can take TV. EVERYWHERE.
> The information contained in this e-mail message is the confidential information of THIS
TECHNOLOGY, Inc. and is intended for use only by the individual or entity above. If the reader
of this message is not the intended recipient, you are hereby notified that any dissemination,
distribution, or duplication of this message is strictly prohibited. If you have received
this message in error, please immediately notify us by telephone and return the original message
to us. Thank you.

Claus Ibsen
Red Hat, Inc.
Twitter: davsclaus
Author of Camel in Action:

View raw message