[
https://issues.apache.org/jira/browse/CAMEL-19951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17772765#comment-17772765
]
Claus Ibsen commented on CAMEL-19951:
-------------------------------------
You can enable tracer per route
from("direct:start").tracing()
.to("mock:foo").id("foo")
.to("mock:bar").id("bar");
Also take a look at backlog tracer - it collects a backlog of the trace details
which you can access on-demand, and can be dumped to xml or json.
Camel JBang and other tools uses this.
The "old legacy tracer" that you refer to not a priority and is there only for
logging, but we want to deprecate and remove it in the future.
> 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
> Priority: Major
>
> 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)