Skip to content

Feature Request: Add Langfuse Tracing #219

Closed as not planned
Closed as not planned

Description

@tito

Summary

Add tracing/observability to OpenCode using Langfuse.

Why

  • Currently no way to trace execution or monitor performance
  • Difficult to debug issues in production
  • Missing insights on usage patterns and bottlenecks

Proposal

Integrate Langfuse (https://langfuse.com/) for tracing, which is already supported by Goose (https://block.github.io/goose/) per their documentation.

Benefits

  • Simple debugging
  • Performance monitoring
  • Usage analytics
  • Low implementation effort

Activity

  1. self-assigned this
    on Jun 20, 2025
  2. ColeMurray commented on Jun 21, 2025

    @ColeMurray

    langfuse supports Otel, so preferably we could instrument with Otel and have langfuse as one of N many different OtelProcessors

    https://langfuse.com/docs/opentelemetry/get-started

  3. adrielp commented on Jul 17, 2025

    @adrielp

    👍🏼 to this. Would love to be able to opt-in to emitting native instrumentation for as much of the stack as possible simply by adding the OTEL exporter env vars + leveraging the GenAI semantic conventions I'd be happy to assist on this as well.

  4. mattzhango commented on Sep 7, 2025

    @mattzhango

    +1 to having tracing/observability, especially with the release of the SDK

  5. noamzbr commented on Dec 5, 2025

    @noamzbr
    Contributor

    Following #4978, Langfuse tracing is now possible with a minimal plugin that can look something like

    /**
     * Langfuse OpenTelemetry Plugin for OpenCode
     * 
     * Requires: bun add @langfuse/otel @opentelemetry/sdk-node
     * Env vars: LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_HOST
     */
    import { NodeSDK } from "@opentelemetry/sdk-node"
    import { LangfuseSpanProcessor } from "@langfuse/otel"
    
    let initialized = false
    
    export const LangfusePlugin = async () => ({
      async config(config) {
        if (!config.open_telemetry || initialized) return
        initialized = true
    
        const processor = new LangfuseSpanProcessor()
        new NodeSDK({ spanProcessors: [processor] }).start()
    
        // // Flush frequently - Required in headless mode to make sure flushes are made before process exit
        // setInterval(() => processor.forceFlush(), 500)
      },
    })
    

    (Probably worth finding a better solution for headless mode)

  6. modelnova-ai commented on Dec 6, 2025

    @modelnova-ai

    Following #4978, Langfuse tracing is now possible with a minimal plugin that can look something like

    /**
     * Langfuse OpenTelemetry Plugin for OpenCode
     * 
     * Requires: bun add @langfuse/otel @opentelemetry/sdk-node
     * Env vars: LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_HOST
     */
    import { NodeSDK } from "@opentelemetry/sdk-node"
    import { LangfuseSpanProcessor } from "@langfuse/otel"
    
    let initialized = false
    
    export const LangfusePlugin = async () => ({
      async config(config) {
        if (!config.open_telemetry || initialized) return
        initialized = true
    
        const processor = new LangfuseSpanProcessor()
        new NodeSDK({ spanProcessors: [processor] }).start()
    
        // // Flush frequently - Required in headless mode to make sure flushes are made before process exit
        // setInterval(() => processor.forceFlush(), 500)
      },
    })
    

    (Probably worth finding a better solution for headless mode)

    Is it possible to record telemetry on a per user level with this plugin? if not how to trace user level tracing in langfuse

  7. added a commit that references this issue on Jan 1, 2026
  8. omercnet commented on Jan 11, 2026

    @omercnet
  9. pai4451 commented on Jan 13, 2026

    @pai4451

    @omercnet Do you know what opentelemetry metrics does opencode emits? I couldn't find any telemetry metrics and logs even I configure

    {
      "experimental": {
        "openTelemetry": true
      },
      "plugin": ["opencode-plugin-langfuse"]
    }
    
  10. omercnet commented on Jan 13, 2026

    @omercnet

    @pai4451 make sure you set env vars properly, try in terminal first with opencode --print-logs --log-level WARN run test to see any warning logs

    and kindly open issues on the plugin repo so we can handle any bugs

  11. Betula-L commented on Mar 23, 2026

    @Betula-L

    I tested with Langfuse, and the main core gap seems to be handling incoming traceparent headers on the server side.

  12. added a commit that references this issue on Apr 7, 2026
  13. github-actions commented on May 23, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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