Library instrumentation: hint if noop to minimize perf impact #1882
lmolkova
started this conversation in
Ideas -> please open issues instead for feature requests!
Replies: 1 comment
-
I am not sure I understand well, but in case of .NET if there is not listener, ActivitySource.StartActivity() will return null, and I am pretty sure that StartActivity has been build to have no perf impact when there is no listener. You only pay for having an ActivitySource instance. There is also activity.IsAllDataRequested which will return true only if this activity has been marked as recorded for the current sampler. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While instrumenting libraries, if there is no OTel SDK/agent, I'd like to disable library instrumentation completely:
For this, I'd need some way on Global OpenTelemetry to check if it's noop (dynamically, since it can change at any moment). Is there a current mechanism for it or any existing issues on that - could not find any?
It seems my best bet currently is to check Tracer/SpanBuilder/Span implementation class name which is not great, but a reasonable hack.
Any practices in each language - e.g. .NET has
ActivitySource
(akaTracer
) withHasListeners
hint.Are there any other libraries interested in such capabilities?
Beta Was this translation helpful? Give feedback.
All reactions