Conversation
document how to run the Aspire dashboard and view traces add OpenTelemetry middleware helper with OTLP exporters wire middleware into basic_mcp_http.py and auto-configure when OTEL endpoint set
There was a problem hiding this comment.
Pull request overview
This PR adds OpenTelemetry instrumentation support for the MCP HTTP server to enable observability through the .NET Aspire Dashboard. It introduces a reusable middleware pattern for capturing traces, metrics, and logs from MCP operations, with automatic configuration when the OTLP endpoint environment variable is set.
- Implements
OpenTelemetryMiddlewareto create spans for MCP tool calls, resource reads, and prompt retrievals - Adds
configure_aspire_dashboardhelper function to wire up OTLP exporters for traces, metrics, and logs - Integrates the middleware into
basic_mcp_http.pywith conditional auto-configuration based on environment variable
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| servers/opentelemetry_middleware.py | Adds OpenTelemetry middleware class and Aspire Dashboard configuration function with OTLP exporters for traces, metrics, and logs |
| servers/basic_mcp_http.py | Integrates OpenTelemetry middleware and enables conditional auto-configuration when OTEL_EXPORTER_OTLP_ENDPOINT is set |
| README.md | Documents how to run and access the Aspire Dashboard for viewing OpenTelemetry data from the MCP server |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
OpenTelemetryMiddlewareplusconfigure_aspire_dashboardhelper that wires spans/metrics/logs to OTLP.basic_mcp_http.pyto enable the middleware and auto-configure Aspire whenOTEL_EXPORTER_OTLP_ENDPOINTis present.