Skip to content

Scope tracing per pipeline via runtime parameters #1785

Description

@vblagoje

Is your feature request related to a problem? Please describe.

Currently, tracing in Haystack is globally enabled or disabled for all pipelines via the tracer configuration (e.g., Langfuse). This means that if tracing is enabled, it applies to every pipeline in the interpreter, and there is no built-in way to scope tracing to a specific pipeline or to enable/disable tracing dynamically per pipeline execution. This is an issue for users who run multiple pipelines in the same process and want to trace only a subset of them.

Describe the solution you'd like

I would like the ability to enable or disable tracing on a per-pipeline or per-run basis. Ideally, this could be achieved by:

  • Allowing a runtime parameter (e.g., tracing_enabled) to be passed to the tracing component (such as LangfuseConnector) in the pipeline.
  • The tracing component (and/or the DefaultSpan implementation) should inspect this parameter at runtime and decide whether to emit traces for that pipeline run execution.
  • We are talking about Langfuse here but perhaps this should be standardized across all tracing frameworks

Describe alternatives you've considered

  • Passing a custom flag (e.g., tracing_enabled) in the invocation context and customizing the tracing component to check this flag before emitting traces. However, this requires custom code and is not supported out of the box.

Additional context
For origination see this Discord exchange.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions