| Capability | What It Does |
|---|---|
| OpenTelemetry tracing | Automatic spans for all 33 SDK flows with parent-child hierarchy |
| Structured logging | JSON log entries with trace correlation, sent to any backend |
| Request log collection | Per-request aggregated view of all events during a request lifecycle |
this.telemetry API | Developer-facing API for custom spans, events, and attributes in tools |
| Vendor integrations | OTLP, Coralogix, Datadog, Logz.io, Grafana, winston, pino |
How It Works
- Zero config — 103+ hooks register automatically on every flow
- Single trace ID — all spans in a request share the same W3C trace ID
- Privacy-safe session ID — a truncated SHA-256 hash, never the real session ID
- Zero overhead when unused — without a TracerProvider, all OTel calls are no-ops
- MCP-interoperable — uses
rpc.system = "mcp"andmcp.*attributes for cross-framework tracing
What Gets Instrumented
Every flow in the SDK is automatically traced:| Category | Flows |
|---|---|
| HTTP & Transport | HTTP requests, SSE sessions, Streamable HTTP, Stateless HTTP |
| Tools | call-tool (every stage), list-tools |
| Resources | read-resource, list-resources, list-templates, subscribe, unsubscribe |
| Prompts | get-prompt, list-prompts |
| Agents | call-agent (with nested tool call tracking) |
| Auth | auth:verify, session:verify |
| OAuth | token, authorize, callback, provider-callback, register |
| Skills | search, load, llm-txt, llm-full-txt, API |
| Elicitation | request, result |
| Other | completion, well-known endpoints, logging/set-level |
Logging vs Tracing
They’re complementary, not competing:| Logging | Tracing | |
|---|---|---|
| What | Event stream — discrete log lines | Request lifecycle — spans with timing |
| Purpose | Debug, audit, error forensics | Performance analysis, dependency mapping |
| Export to | Stdout, winston, pino, OTLP | OTLP, Jaeger, Zipkin |
| Connection | trace_id on every log line | Native parent-child span tree |
trace_id, platforms like Coralogix or Datadog show logs inline within a trace waterfall.
Learn More
Setup Guide
Step-by-step: install, configure backends, use this.telemetry
Telemetry API Reference
Full API for TelemetryAccessor, TelemetrySpan, and testing utilities
OpenTelemetry
OpenTelemetry documentation
Plugin System
How plugins hook into the request lifecycle