Skip to content

OpenTelemetry exporter for traces and metrics #990

Open

Description

@helpcodeai

Everything needed is already recorded — tool call, duration, status, upstream response — it just cannot leave the box in a standard format.

Scope

  • OTLP exporter behind OTEL_EXPORTER_OTLP_ENDPOINT, off when unset.
  • One span per MCP tool call, with a child span for the upstream request.
  • Attributes: connector, tool, MCP server, org, status, upstream status code. No parameter values and no response bodies — this is a product whose pitch is that data does not leave your network, and a trace exporter is an easy way to break that promise by accident.
  • Metrics: call count, duration histogram, error count, by tool.

Good issue for someone who has wired OTel into a NestJS app before.

Activity

  1. added
    help wanted
    roadmap
    on Oct 10, 2026
  2. AYUshJaiswal454 commented on Dec 6, 2026

    @AYUshJaiswal454
    Contributor

    Hi @helpcodeai, I'd like to work on this after #1963. I looked at what exists today: tracing.ts already exports HTTP/Express/DB spans over OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is set, and since #984 /metrics has the tool-call counters and latency histograms in Prometheus. What's missing is the tool call itself. I'd split it into small PRs:

    1. A span per MCP tool call, following the OpenTelemetry MCP semantic conventions: name tools/call {tool}, attributes mcp.method.name, gen_ai.operation.name: execute_tool, gen_ai.tool.name, plus the connector type, connector id, MCP server id, org id, status, upstream status code and error.type on failure. The upstream HTTP request becomes its child span automatically. No parameter values or response bodies, and a no-op when OTLP is not configured.
    2. OTLP metrics: call count, a duration histogram and errors by tool, the same numbers as /metrics, exported only when the endpoint is set.
    3. (optional) Trace context from the client: continue the caller's trace when a tools/call carries traceparent in params._meta, as the MCP conventions describe.

    Does this split work for you, and should tool names stay off Cloud spans like they do on the Prometheus labels?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedroadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions