Skip to content

Conversation

@majiayu000
Copy link
Contributor

Summary

  • Add OpenTelemetry instrumentation for MCP tool calls
  • Tracing: spans for each tool call with tool name and error status
  • Metrics: request counter and duration histogram
  • Configurable via environment variables

Configuration:

  • MKP_OTEL_ENABLED: Enable OpenTelemetry (default: false)
  • MKP_OTEL_SERVICE_NAME: Service name (default: mkp)
  • MKP_OTEL_SERVICE_VERSION: Service version (default: 0.1.0)
  • OTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint for trace export

Closes #37

Test plan

  • Unit tests for config and middleware
  • All existing tests pass
  • Manual test with Jaeger or other OTLP collector

Add OpenTelemetry instrumentation for MCP tool calls. This provides:
- Distributed tracing with spans for each tool call
- Metrics for request counts and latency
- Configurable via environment variables

Configuration:
- MKP_OTEL_ENABLED: Enable/disable OpenTelemetry (default: false)
- MKP_OTEL_SERVICE_NAME: Service name (default: mkp)
- OTEL_EXPORTER_OTLP_ENDPOINT: OTLP collector endpoint

Closes StacklokLabs#37

Signed-off-by: majiayu000 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Support for OpenTelemetry Metrics & Tracing

1 participant