Skip to content

Event API should accept Context instead of specific trace_id, span_id, trace_flags #4328

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

Open
aabmass opened this issue Nov 27, 2024 · 2 comments · May be fixed by #4344 or #4597
Open

Event API should accept Context instead of specific trace_id, span_id, trace_flags #4328

aabmass opened this issue Nov 27, 2024 · 2 comments · May be fixed by #4344 or #4597
Assignees
Labels
api Affects the API package. sdk Affects the SDK package.

Comments

@aabmass
Copy link
Member

aabmass commented Nov 27, 2024

See specification here https://github.com/open-telemetry/opentelemetry-specification/blob/v1.39.0/specification/logs/event-api.md#emit-event

Right now we accept specific fields from SpanContext which doesn't handle extra context stuff like baggage

trace_id: Optional[int] = None,
span_id: Optional[int] = None,
trace_flags: Optional["TraceFlags"] = None,

@tammy-baylis-swi
Copy link
Contributor

I've made a first attempt at this. If we change the Logging API (e.g. immediate replacement of trace_id etc with span_context) then I think the Events API needs to change too because Event(LogRecord): #4584

Two of the instrumentor ci/cd tests fail on that PR because contrib changes are also needed in the OpenAi and Botocore instrumentors: open-telemetry/opentelemetry-python-contrib#3528

Would it make sense to do a "transition" release where we introduce span_context and deprecate trace_id etc, to be fully removed later? I was thinking this could be one way to get everything to keep working and pass through the release process.

What are some other things to consider? I'd like to help with stabilizing the Logging API and this is my first time really working on it.

@tammy-baylis-swi
Copy link
Contributor

Thank you to Python SIG for guidance at this week's meeting! I've made a new PR to introduce more backwards-compatible changes to the Logging API to accept Context (not SpanContext!). This should not require any Events API changes nor Instrumentor changes: #4597

@tammy-baylis-swi tammy-baylis-swi self-assigned this May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment