Skip to content

Conversation

@madebygps
Copy link
Collaborator

  • Document how to view traces with the Aspire dashboard (docker run, env export, access URL).
  • Add OpenTelemetryMiddleware plus configure_aspire_dashboard helper that wires spans/metrics/logs to OTLP.
  • Update basic_mcp_http.py to enable the middleware and auto-configure Aspire when OTEL_EXPORTER_OTLP_ENDPOINT is present.

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
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OpenTelemetryMiddleware to create spans for MCP tool calls, resource reads, and prompt retrievals
  • Adds configure_aspire_dashboard helper function to wire up OTLP exporters for traces, metrics, and logs
  • Integrates the middleware into basic_mcp_http.py with 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

madebygps and others added 3 commits December 9, 2025 11:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@madebygps madebygps merged commit 197d291 into Azure-Samples:main Dec 9, 2025
2 checks passed
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.

2 participants