Raymond created CAMEL-19951:
-------------------------------
Summary: Enhance the tracer
Key: CAMEL-19951
URL: https://issues.apache.org/jira/browse/CAMEL-19951
Project: Camel
Issue Type: Wish
Affects Versions: 3.20.7
Reporter: Raymond
I really like the tracer:
[https://camel.apache.org/manual/tracer.html]
I wish it could be enhanced, so it becomes more flexible to use for more uses.
Some ideas:
1. Enable tracing on route level
Currently, tracing can only be enabled on the CamelContext. When there are
hundreds of routes, this quickly becomes cluttered. This could be enabled like
as follows:
{code:java}
Tracer tracer = context.getTracer();
tracer.setByRouteId("routeid");{code}
or
{code:java}
Route route = context.getRoute("routeid");
route.setTracer(true);{code}
or
{code:java}
<route id="someroute" tracer="true">
<from uri="direct:someroute"/>
<to uri="log:justsomeroute"/>
</route>{code}
2. Event Notifier
Instead of writing it to the log I would rather use it in the EventNotifier:
{code:java}
Tracer tracer = context.getTracer();
tracer.sendToEventNotifier(true);
tracer.sendToLog(false);{code}
The EventNotifier could receive a "TraceEvent" (or MessageEvent?). There could
also be sub TraceEvents (similar to ExchangeEvent that has a subevent
ExchangeCreatedEvent):
TraceEvent
TraceRouteEvent
TraceRouteInputEvent
TraceRouteOutputEvent
TraceNodeEvent
3. Trace Event object
The Trace Event object that is used by the event notifier could contain:
Timestamp
BreadcrumpId (MessageId)
RouteId (or Route object)
Direction (input or output)
Type: (Route or Node)
Name: (name of route or node)
Node (id / number of node)
Exchange
It would also be nice if the object can be serialized to a json.
{code:java}
CamelEvent.TracerEvent tracerEvent = (CamelEvent.TracerEvent) event;
traceEvent.toJson();{code}
4. Filters
Sometimes you only want to trace a part of the exchange
{code:java}
Tracer tracer = context.getTracer();
tracer.includeProperties(false);
tracer.includeHeaders(true);
tracer.includeBody(false);
tracer.includeBodyType(true);{code}
Hopefully these wishes/feedback about the tracer are useful.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)