Possibility to suppress traces in certain scopes like background services #5932
-
Hi I'm enabling traces in my framework used for building microservices. In my scenario I'm looking for best option to enable traces on web API requests. So I have added Unfortunately my microservices also have multiple background service for which I do not wish to collect traces. Those services are aggressively polling db, Redis and other storage's. They are optimized and do not requires traces yet pollute a lot. Is there any correct way to mark a scope as not traceable. I could not find similar question nor example but perhaps I missed something. I found that:
Perhaps there is something build in for that that has minimal performance impact and will suite this case. Or any of my workarounds is valid and can be used with long living background services (application lifetime) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @plachor, For the sake of conversation, lets assume you have multiple microservices: A -> B -> C -> D
|
Beta Was this translation helpful? Give feedback.
Hi @plachor,
Sorry I don't fully understand your scenario.
For the sake of conversation, lets assume you have multiple microservices: A -> B -> C -> D
It sounds like you want to collect Http requests for your first microservice (A), but not for any of the downsteam services.
If I'm understanding you correctly, in this scenario you would not add OpenTelemetry to B, C, or D.
You already found two work arounds above 1 & 2, and you were asking about performance impact.
For 1 there should be no impact. When you call the API to create an Activity, if there is no subscribed listener, no Activity is created. These APIs should return null. For 2, this is the recommended way to suppress calls t…