Otel agent tracing
Skill thebharathkumar/agent-flight-recorder/skills/otel-agent-tracing
Instrument a LangGraph or MCP agent with OpenTelemetry spans and view them locally in Jaeger and Grafana. Use when the user asks to add tracing or observability to an agent, see spans or traces from agent runs, set up Jaeger or Grafana locally, or debug agent latency and failures with traces.From its SKILL.md
npx -y skills add thebharathkumar/agent-flight-recorder --skill otel-agent-tracingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.5 KB, as published. Nobody here has run it
OTel Agent Tracing
Adds OpenTelemetry instrumentation to an agent and stands up a local
observability stack (OTel Collector, Jaeger, Grafana) with docker compose.
Target: first trace visible in Jaeger within 5 minutes;
references/first-trace.md is the walkthrough version of this procedure.
Procedure
- Detect the stack. Look for
langgraph,fastmcp, ormcpin the project dependencies. This decides step 3. - Install SDK deps in the target project:
pip install "opentelemetry-sdk>=1.30,<2" "opentelemetry-exporter-otlp-proto-grpc>=1.30,<2". Copytemplates/otel_setup.pyinto the project and callconfigure_otel(service_name=...)once at startup. It attaches an OTLP gRPC exporter whenOTEL_EXPORTER_OTLP_ENDPOINT(or theotlp_endpointargument) is set, and an OTLP JSON file exporter whenfile_export_path(orOTEL_FILE_EXPORT) is set. The file path works with no docker at all and feeds the trace-triage skill directly. - Instrument by stack:
- LangGraph: copy
templates/langgraph_tracing.pyand wrap each node withtraced_node(graph_name, node_name, agent_id). Nodes become spans named{graph}.{node}carryinggen_ai.operation.name,agent.id,run.id, andturnfrom state; exceptions set ERROR status and, when the exception has aclassificationattribute, afailure.classificationspan attribute. - fastmcp (jlowin): native telemetry already emits semconv-shaped spans. Only step 2 is needed.
- Official
mcpSDK server: emit spans named{mcp.method.name} {target}withSpanKind.SERVERand the attributes inreferences/semconv.md. Prefer SDK-native OTel if the installed version ships it. - Warn if the project uses Traceloop's
McpInstrumentororlogfire.instrument_mcp(): measured against OTel semconv v1.40.0, neither emits the requiredmcp.method.nameattribute.
- LangGraph: copy
- Start the local stack:
docker compose -f <skill>/assets/docker-compose.yml up -d. Services: otel-collector (4317 grpc, 4318 http), Jaeger UI (16686), Grafana (3000, Jaeger datasource provisioned). The collector also mirrors spans tocaptures/otlp.jsonfor the trace-triage skill. If docker is unavailable, skip this step and use the file exporter from step 2 instead. - Run the agent once with
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317, then open http://localhost:16686, select the service name, and confirm the trace renders. Show the user what to look for: one root span per run, child spans per node or tool call. - Optional conformance check:
references/conformance.mddescribes the OTel Weaver live-check loop that scores spans against the official semantic conventions.
Files
templates/otel_setup.py: SDK boilerplate plus the OTLP JSON file exporter.templates/langgraph_tracing.py: per-node span wrapper.assets/docker-compose.yml,assets/otel-collector-config.yaml,assets/grafana-provisioning/: the local stack.references/first-trace.md: 5 minute walkthrough.references/semconv.md: exact span names, attributes, and the fourmcp.*.durationhistograms worth emitting.references/conformance.md: Weaver-based semconv self-audit.