otel-agent-tracing
Skill0 starsChanged 4 months agoMITView on GitHub
Instrument a LangGraph or MCP agent with OpenTelemetry spans and
- Installs packages
In this repository3 other files it gives its agents.
- agent-eval-scaffoldSkill
- audit-logSkill
- trace-triageSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
Start the local stack: docker compose -f <skill>/assets/docker-compose.yml up -d.
- Very specific: line 53
Run the agent once with OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317, then open http://localhost:16686, select the service name, and …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

