More metrics in Apache Camel 2.14
Apache Camel 2.14 is being released later this month. There is a slight holdup due some Apache infrastructure issue which is being worked on.
This blog post is to talk about one of the new functions we have added to this release. Thanks to Lauri Kimmel who donated a camel-metrics component, we integrated with the excellent codehale metrics library.
So I took this component one step further and integrated it with the Camel routes so we have additional metrics about the route performances using codehale metrics. This allows end users to seamless feed Camel routing information together with existing data they are gathering using codehale metrics.
Also take note we have a lot of existing metrics from camel-core which of course is still around.
What codehale brings to the table is that they have additional statistical data which we do not have in camel-core.
To use the codehale metics all you need to do is:
- add camel-metrics component
- enable route metrics in XML or Java code
To enable in XML you declare a as shown below:
&;t;bean id="metricsRoutePolicyFactory" class="org.apache.camel.component.metrics. routepolicy.MetricsRoutePolicyFactory"/>
And doing so in Java code is easy as well by calling this method on your CamelContext
context.addRoutePolicyFactory(new MetricsRoutePolicyFactory());
Now performance metrics is only useable if you have a way of displaying them, and for that you can use hawtio. Notice you can use any kind of monitoring tooling which can integrate with JMX, as the metrics is available over JMX. The actual data is 100% codehale json format, where a piece of the data is shown in the figure below.
The next release of hawtio supports Camel 2.14 and automatic detects if you have enabled route metrics and if so, then shows a sub, where the information can be seen in real time in a graphical charts.
The screenshot above is from the new camel-example-servlet-rest-tomcat which we ship out of the box. This example demonstrates another new functionality in Camel 2.14 which is the Rest DSL (I will do a blog about that later). This example enables the route metrics out of the box, so what I did was to deploy this example together with hawtio (the hawtio-default WAR) in Apache Tomcat 8.
With hawtio you can also build custom dashboards, so here at the end I have put together a dashboard with various screens from hawtio to have a custom view of a Camel application.
Reference: | More metrics in Apache Camel 2.14 from our JCG partner Claus Ibsen at the Claus Ibsen riding the Apache Camel blog. |