...
The metrics: component allows to collect various metrics directly from Camel routes. Supported metric types are counter, histogram, meter and timer. Metrics provides simple way to measure behaviour of application. Configurable reporting backend is enabling different integration options for collecting and visualizing statistics. The component also provides a MetricsRoutePolicyFactory
which allows to expose route statistics using codehale metrics, see bottom of page for details.
...
Each metric has type and name. Supported types are counter, histogram, meter and timer. Metric name is simple string. If metric type is not provided then type meter is used by default.
...
Name |
Default |
Description |
useJmx |
false |
Whether to report fine grained statistics to JMX by using the com.codahale.metrics.JmxReporter . Notice that if JMX is enabled on CamelContext then a MetricsRegistryService mbean is enlisted under the services type in the JMX tree. That mbean has a single operation to output the statistics using json. Setting useJmx to true is only needed if you want fine grained mbeans per statistics type. |
jmxDomain |
org.apache.camel.metrics |
The JMX domain name |
prettyPrint |
false |
Whether to use pretty print when outputting statistics in json format |
metricsRegistry |
|
Allow to use a shared com.codahale.metrics.MetricRegistry . If none is provided then Camel will create a shared instance used by the this CamelContext. |
rateUnit |
TimeUnit.SECONDS |
The unit to use for rate in the metrics reporter or when dumping the statistics as json. |
durationUnit |
TimeUnit.MILLISECONDS |
The unit to use for duration in the metrics reporter or when dumping the statistics as json. |
From Java code tou can get hold of the com.codahale.metrics.MetricRegistry
from the org.apache.camel.component.metrics.routepolicy.MetricsRegistryService
as shown below:
...