-
Notifications
You must be signed in to change notification settings - Fork 421
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
[Feature]: Allow setting TraceContext on opentelemetry::logs::LogRecord #2106
Comments
Thanks @KodrAus. this seems valid. do you want to contribute the PR, else I should be able to pick this up sometime next week. |
I’m happy to put a PR together for this 👍 I imagine at some point you’ll be locking down those traits so they can be stabilized. |
Thanks @KodrAus. Yes, we are targeting RC in Oct, so would have stable API by then, |
I've opened #2129 for this. As an aside, it was probably discussed somewhere, but I thought the API here was a little surprising. The |
The OpenTelemetry API is intentionally minimal, leaving implementation details to the SDK. This gives users the flexibility to bring their own SDKs without being forced into specific design choices. For example, with |
Related Problems?
No response
Describe the solution you'd like:
The new
opentelemetry::logs::LogRecord
trait supports a subset of the data on theopentelemetry_sdk::logs::LogRecord
struct. One thing it's missing is the ability to set theTraceContext
.This is something I was using to ensure logs emitted via OpenTelemetry would include trace context, even if that context is not managed via OpenTelemetry itself. Since the
TraceContext
is optional, we should be able to tell when processing the resulting record whether the caller explicitly set a context, and fill it in with OpenTelemetry's current if not.A method on
LogRecord
likefn set_trace_context(&mut self, ctxt: TraceContext)
would cover my needs.Considered Alternatives
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: