First and foremost, @Niels_de_Feijter, welcome to the forum!
Secondly:
No worries, perfectly fine to do multiple posts. All that’s needed to get the point across if you ask me
Now, on to the question.
What you’re seeing, is that Axon Framework’s StreamingEventProcessor
will read all events that it reads from the event store. Regardless of whether there’s an event handler for the given event.
The EventProcessor
will process a batch of events, and it’s there where the SpanFactory
is invoked to set a span. The EventProcessor
will provide events to the so-called EventHandlerInvoker
; this is the wrapper class around your class containing the event handling methods. It’s the EventHandlerInvoker
that will check if there’s an event handler for the given event, as you can see here.
Thus, sadly, the span creation occurs before the actual handling of the event. Hence, this noise is…well, just there.
There is a way to filter some of these, though, which would be done by filtering the events from the event store. This is something the TrackingEventProcessor
implementation can do whenever there are no event handlers for a given event type present within that event processor.
However, for this to work, the “Event Stream” implementation should support that feature. Right now, only an event stream coming from Axon Server does so.
Note that even when using Axon Server and Event Processors telling the stream to not give certain events, it will still give them from time to time. By default after every 1000 events. This is done to ensure that, if event handlers are added to the processor at a later stage, the known set of filtered events can be updated.
Long story short, the added spans with name EventProcessor.process
will thus exist always, with one caveat: If you are using a TrackingEventProcessor
! The PooledStreamingEventProcessor
(PSEP, for short) does an earlier validation if there are event handlers for a given event. Hence, if you switch your processors to the PSEP, you should eliminate a lot of your logging.
Let us know whether that solves your issue, @Niels_de_Feijter!