Skip to content

Add configurable trace tags - #58

Open
tfon23 wants to merge 1 commit into
langfuse:mainfrom
tfon23:feat/configurable-trace-tags
Open

tfon23 wants to merge 1 commit into
langfuse:mainfrom
tfon23:feat/configurable-trace-tags

Conversation

@tfon23

@tfon23 tfon23 commented Oct 26, 2026

Copy link
Copy Markdown

Closes #57

Adds configurable trace tags, settable from two sources (per @bezbac in #57; no LANGFUSE_TAGS env var):

  • an optional tags array in ~/.config/opencode/opencode-langfuse.json
  • an optional plugin option in the OpenCode config, which takes precedence over the config file

Tags are applied to every exported span via the langfuse.trace.tags attribute (an array of strings), matching the official Langfuse JS SDK, so Langfuse maps them to trace tags.

Usage

Config file (~/.config/opencode/opencode-langfuse.json):

{
  "publicKey": "pk-lf-...",
  "secretKey": "sk-lf-...",
  "tags": ["app:opencode-sdx"]
}

Plugin option (OpenCode 2):

{
  "plugins": [["@langfuse/opencode-observability-plugin", { "tags": ["app:opencode-sdx"] }]]
}

Plugin option (OpenCode 1):

{
  "plugin": [["@langfuse/opencode-observability-plugin", { "tags": ["app:opencode-sdx"] }]]
}

When both are set, the plugin option wins (mirroring how environment variables override the config file for the other settings). A malformed tags value is ignored with a warning rather than disabling tracing.

Tests

  • v1 + v2 integration tests assert the tag lands on exported spans via the plugin option, and that no langfuse.trace.tags attribute is emitted when no tags are configured.
  • runtime tests cover config-file tags, plugin-option precedence, and decodePluginTags handling of absent/malformed/unknown-key input.

All checks pass: format, build, lint, knip, and the integration suite.

@CLAassistant

CLAassistant commented Oct 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Allow setting Langfuse trace tags from the opencode-langfuse.json config file (tags array) or as a plugin option in the OpenCode config, which takes precedence. Tags are applied to every exported span via the langfuse.trace.tags attribute.
@tfon23
tfon23 force-pushed the feat/configurable-trace-tags branch from 378877f to 4ff1cfd Compare October 26, 2026 17:45
@tfon23

tfon23 commented Oct 26, 2026

Copy link
Copy Markdown
Author

@bezbac Hello can you help me by approving ?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: configurable trace tags (follow-up to #34)

2 participants