Reputation: 1202
I want to time the performance of steps in my route. I was looking at using camel AOP to start a timer, run the step, stop and log the timer. However AOP is now deprecated, I looked at using the Intercept mechanism, but it just adds 'advice' before, I need it after too. Is there a clean way to do this?
Upvotes: 3
Views: 9934
Reputation: 118
very simple way for me:
...
.process(exchange -> exchange.getIn().setHeader("start", DateTime.now()))
.to("direct:calc")
.process(exchange -> exchange.getIn().setHeader("end", DateTime.now()))
.log("=== route execution time: ${header.start} - ${header.end}")
Upvotes: 3
Reputation: 8306
You've got a lot of choices here, including pursuing your initial idea
1) You can easily hook into Camel's EventNotifier, there is a basic example here http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html
INFO CamelContextFactoryBean - Using custom EventNotifier with id: myLoggingEventNotifier and implementation: org.apache.camel.processor.MyLoggingSentEventNotifer@76bf9e
INFO MyLoggingSentEventNotifer - Took 1001 millis to send to: Endpoint[direct://bar]
INFO MyLoggingSentEventNotifer - Took 0 millis to send to: Endpoint[mock://result]
INFO MyLoggingSentEventNotifer - Took 1013 millis to send to: Endpoint[direct://start]
2) You can use Fuse IDE, example here http://fusesource.com/docs/ide/2.1/tutorials/RiderTutorialTrace.html
3) You can connect to your java instance with JMX and there's a lot of information you can grab from there
Upvotes: 7
Reputation: 55710
Yeah there is many choices.
Just a correction to the comment above about Fuse IDE. This editor is open source and free to use for anyone. You do not need a subscription. We offer this free since Red Hat acquired us.
1) About the monitoring. Then you can check some of the blogs http://camel.apache.org/articles where people have written about monitoring Camel apps.
2) And there is some 3rd party apps at http://camel.apache.org/user-stories.html such as CamelWatch, etc.
3) James Strachan (founder of Camel) and others from the Fuse team is working on a web console for Camel and other integration frameworks, called Hawt IO - http://hawt.io/
4) As Alan already pointed out, you can use the event notifier, which emits events which you can tap into.
5) There is the JMX API which 3rd party tooling can integrate with such as Fuse HQ / JON / Hyperic / and others
6) There is a camel-nagios component for nagios integration
7) And there is also some details in chapter 12 in the Camel in Action book: http://manning.com/ibsen/
8) There is also the log component which can log performance using the group size / group interval option http://camel.apache.org/log
9) And there is the tracer which can also be used for tracing and measure performance of routing http://camel.apache.org/tracer
Upvotes: 9