Skip to content

[Feature/Bug] Generic tags in trace payload are nested in metadata for Langfuse or Langsmith, breaking native UI. #225

@Aksherwal

Description

@Aksherwal

Context:
When using OpenRouter's raw HTTP payload to broadcast observability data to Langfuse, passing an array of "tags" inside the trace object does not populate Langfuse's native Tags UI.

Expected Behavior:
Just as OpenRouter natively maps "ls.tags" for LangSmith, passing "tags": ["prod", "testing"] inside the trace object should result in top-level OpenTelemetry span attributes that Langfuse recognizes and promotes to its native UI tags. (Note: The OpenRouter "Send Test Trace" button achieves this perfectly).

Actual Behavior:
Because OpenRouter's generic OTEL exporter does not recognize the generic "tags" key, it wraps the array inside a generic "metadata" dictionary envelope before broadcasting.
Because the tags are nested in metadata rather than sent as top-level span attributes, Langfuse displays them as raw JSON metadata instead of native UI pills.

Steps to Reproduce:

  1. Send a raw HTTP request to /chat/completions.

  2. Include the following trace object:

"trace": {
  "trace_id": "valid-uuid-here",
  "tags": ["testing", "observability"]
}
  1. View the trace in Langfuse. The tags will appear in the Metadata table, not the Tags column.

The Current Workaround:
Developers must bypass the generic "tags" key and explicitly pass Langfuse's proprietary OTEL namespace key in the payload:

"trace": {
  "langfuse.trace.tags": ["testing", "observability"]
}

Proposed Solution:

API Fix: Update the OpenRouter OTEL translation layer to automatically map a generic "tags" array inside the trace object to standard top-level OTEL tag attributes (or specifically to langfuse.trace.tags when broadcasting to Langfuse).

Docs Fix (Alternative): Explicitly document this behavior on the OpenRouter Observability docs page, noting that users must pass "langfuse.trace.tags" to achieve native UI tags in Langfuse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions