dify - 💡(How to fix) Fix Support custom OpenInference session.id for Service API tracing [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#36095Fetched 2026-05-14 03:46:54
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
1
Participants
Assignees
Timeline (top)
assigned ×1labeled ×1

Fix Action

Fix / Workaround

I've gone ahead creating a demo patch based on Dify 1.6, this video should explain the concept:

RAW_BUFFERClick to expand / collapse

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

In enterprise deployments, Dify is often used as an application engine and integrated primarily through the Service API rather than through the built-in Web or Console UI.

Tracing data is commonly collected by third-party observability platforms, for example Arize Phoenix. These platforms often use the OpenInference semantic convention session.id to group related traces into a logical user/session view.

Today, when calling Dify workflows or chatflows through the Service API, callers do not have a first-class way to provide their own tracing session identifier. This makes it difficult to align Dify traces with the enterprise system's existing session, request, tenant, or user journey identifiers in Phoenix or other OpenInference-compatible tracing backends.

It would be useful if Dify supported an optional way to customize the tracing session ID when invoking apps via the Service API, for example through a request parameter such as trace_session_id or through an HTTP header. This value should only affect the exported tracing attribute, such as OpenInference session.id, and should not create or resume a Dify conversation by itself.

Related version/context: Dify 1.14.1.

I've gone ahead creating a demo patch based on Dify 1.6, this video should explain the concept:

https://github.com/user-attachments/assets/543d409d-3cfe-4795-93fe-5fa001272746

2. Additional context or comments

A possible behavior could be:

  • Service API callers may pass an optional tracing session override, either in JSON body or header.
  • Tracing providers that understand OpenInference semantics, such as Phoenix, can export it as session.id.
  • If the caller does not provide the value, Dify keeps the current default session behavior.
  • The custom tracing session ID remains an observability concern and does not alter conversation_id, workflow run IDs, OpenTelemetry trace IDs, or span parent/child relationships.

3. Can you help us with this feature?

  • I am interested in contributing to this feature.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING