Skip to content

Unable to access current span on add_shutdown_callback or on on_session_end #4416

@debajyoti-truefoundry

Description

@debajyoti-truefoundry

Bug Description

https://docs.livekit.io/deploy/observability/data/#save-conversation-history-example

https://docs.livekit.io/deploy/observability/data/#session-reports

I want to be able to add the whole session report as a span attribute to the root span.

I am unable to do it today because no callback executes after await job_entrypoint_fnc in _traceable_entrypoint.

@tracer.start_as_current_span("job_entrypoint")

By the time the shutdown callback or session end callback is called, the root span has already ended.

Expected Behavior

I should be able to access the root span in shutdown or session end callback so that I can add my own span attributes after the conversation is over.

Reproduction Steps

Not relevant

Operating System

Not relevant

Models Used

No response

Package Versions

Not relevant

Session/Room/Call IDs

No response

Proposed Solution

Additional Context

No response

Screenshots and Recordings

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions