Hide or discard a transaction or span


I have a custom Kafka instrumentation solution which starts a new transaction at reception (KafkaListener interceptor) and correlate it with the producer transaction (see this thread for more info). One of the issue I encounter is that Kafka is used to broadcast events, all the microservices consume the events but depending on the some logic, only a small subset execute the message, the rest of the service just discard the event after reception.

This makes my APM transaction view quite unreadable because a lot of transactions are showing up for every single service just to announce the reception of the event but only a few actually do something.

I know this is related to our architecture and the way we built it but I was wondering if there was a way using the API to discard/delete a transaction based on a certain condition or use a label to hide it from the transaction view ?

Thank you

Kibana version : 7.3.0
Elasticsearch version : 7.3.0
APM Server version : 7.3.0
APM Agent language and version : java 1.8.0
Browser version : n/a
Original install method (e.g. download page, yum, deb, from source, etc.) and version : Kubernetes environment (Docker image)
Fresh install or upgraded from other version? Fresh install
Is there anything special in your setup? No
Other components : Spring-boot:2.1.0.RELEASE, spirng-kafka:2.2.7-RELEASE

Hi and thanks for the question!

Please take a look at this issue, which asks for the ability to discard transactions for other reasons.
Would the API suggested there answer your needs?

Unfortunately it won't work because it's entirely programmatic and depends on the context of the message received.

But if a function disableTransaction or disableSpan were available I could programmatically use it when needed in the logic.
Is this possible to consider this for the future release ?

So why can't you check the context and invoke startTransactionWithRemoteParent only where required (in your surroundOnMessage method)?

The way I read the suggestion in this issue is: either use the annotation API, or use a programmatic API for that (meaning- we should add both), so I assume this will answer what you are looking for. Please see the clarification comment I added and upvote this issue if you find it useful.

Yeah, technically I could do this but this would break the separation of concern between my integration layer / consumers (including the interceptor for tracing) and the business logic layer.
That is why the function Transaction#ignore could be useful in my case.

I upvoted the issue, it would be nice to have for my usecase.

It's not a major issue for me at the moment, I can live with it :slight_smile:

Thanks for your help

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.