Skip to content

Common Tracing Span Attributes #3336

@julian-hecker

Description

@julian-hecker

Problem Statement

Hi all. I am using Langfuse to trace the bot performance. Langfuse has a feature called Sessions which lets you group a set of related spans together. This is separate from grouping by conversation_id (which itself has issues).

What I am looking for is a means to put a span attribute on all children of a pipeline, or at the very least be able to manually add span attributes to individual services.

Currently, I could not find a way to associate services like STT, LLM, and STT with additional tracing metadata. This would be greatly helpful for advanced tracing needs.

Proposed Solution

A new parameter on PipelineTask, perhaps called child_span_attributes which would set a span attribute on each child which emits tracing events.

Alternative Solutions

Each service could also have its own additional_span_attributes parameter which would do the same.

Example

async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
    # ...
    task = PipelineTask(
        pipeline,
        params=pipeline_params,
        enable_tracing=settings.ENABLE_TRACING,
        conversation_id=call_sid,
        # Either have this be "inherited" by services, or add a new parameter `child_span_attributes` which is inherited
        additional_span_attributes={"user.id": "+12345678901", "session.id": call_sid},
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions