-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way for Logs SDK to sample based on span context #3207
Comments
We are currently making an implicit assumption that events are recorded as part of a span, but the specification does not explicitly require this—though all the examples at the end show events within spans. It might be worth updating the specification to clarify this expectation either way. |
My thinking is that traces and logs are two different signals and so they should be ~independent. |
I agree it's cleaner to keep them separate when writing instrumentation. Maybe the logging SDK can provide a means to tie span sampling to event sampling. We have some precedent here in Exemplars where the default ExemplarFilter is TraceBased. |
Discussed in SIG and we agreed Logs/events SDK should have way to configure this behavior. Changing to a feature request and I think we may need a spec discussion |
The OpenAI instrumentation currently only records events if the span is recording:
opentelemetry-python-contrib/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py
Lines 59 to 63 in 2756c1e
This makes sense, since event recording can be quite expensive and we can piggyback on the sampling decision. However it feels like the Logging API should be more integrated and instrumentation shouldn't need to do these checks. Most logging libraries also have an API to check if recording like
Logger.isEnabledFor()
and/or support lazy evaluation of log fields. So two questions areThe text was updated successfully, but these errors were encountered: