Telemetry Module
OpenTelemetry integration for distributed tracing and metrics.
Enable telemetry with environment variables:
OTEL_ENABLED=trueOTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 Copy
OTEL_ENABLED=trueOTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
All OTEL settings are routed through the config system (env vars + config file):
OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_TRACES_EXPORTER
OTEL_LOG_LEVEL
OTEL_METRIC_EXPORT_INTERVAL
Framework-managed env vars:
OTEL_METRICS_EXPORTER
import { initializeTelemetry, withSpan, getTraceContext, serverMetrics } from './telemetry/index.js';// Initialize at startupinitializeTelemetry();// Create spansawait withSpan('myOperation', async (span) => { span.setAttribute('key', 'value'); return await doSomething();});// Get trace context for propagationconst ctx = getTraceContext();// Record metricsserverMetrics.recordRequest('tool_name', 150, true); Copy
import { initializeTelemetry, withSpan, getTraceContext, serverMetrics } from './telemetry/index.js';// Initialize at startupinitializeTelemetry();// Create spansawait withSpan('myOperation', async (span) => { span.setAttribute('key', 'value'); return await doSomething();});// Get trace context for propagationconst ctx = getTraceContext();// Record metricsserverMetrics.recordRequest('tool_name', 150, true);
Telemetry Module
OpenTelemetry integration for distributed tracing and metrics.
Setup
Enable telemetry with environment variables:
All OTEL settings are routed through the config system (env vars + config file):
OTEL_EXPORTER_OTLP_ENDPOINT— OTLP endpoint URLOTEL_TRACES_EXPORTER— Trace exporter: otlp (default), console, noneOTEL_LOG_LEVEL— SDK diagnostic log levelOTEL_METRIC_EXPORT_INTERVAL— Metric export interval (ms)Framework-managed env vars:
OTEL_METRICS_EXPORTER— otlp, prometheus, console, none (default: otlp,prometheus)Usage