Enable HTTP traces for self-hosted Azure MCP server#1227
Merged
srnagar merged 6 commits intomicrosoft:mainfrom Nov 20, 2025
Merged
Enable HTTP traces for self-hosted Azure MCP server#1227srnagar merged 6 commits intomicrosoft:mainfrom
srnagar merged 6 commits intomicrosoft:mainfrom
Conversation
vukelich
reviewed
Nov 20, 2025
vukelich
approved these changes
Nov 20, 2025
anuchandy
approved these changes
Nov 20, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enables HTTP trace telemetry for self-hosted Azure MCP server instances by adding OpenTelemetry support with Azure Monitor integration. The implementation introduces a dedicated telemetry pipeline specifically for HTTP transport mode, along with filtering mechanisms to prevent telemetry loops and duplicate spans.
Key Changes:
- Added a new telemetry configuration method for self-hosted HTTP scenarios that creates an independent TracerProvider with ASP.NET Core and HttpClient instrumentation
- Refactored OpenTelemetry exporter configuration from batch processing to immediate configuration per connection string
- Implemented filtering logic to exclude Application Insights ingestion requests and Azure SDK duplicate spans from instrumentation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| servers/Azure.Mcp.Server/CHANGELOG.md | Documents the new HTTP trace telemetry feature with reference to PR #1227 |
| core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs | Refactors Azure Monitor exporter configuration from batch to immediate setup, clarifies conditional compilation for RELEASE builds |
| core/Azure.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs | Adds TracerProvider initialization for HTTP mode with environment-based controls and implements HTTP request filtering to prevent telemetry issues |
Member
Author
|
/azp run mcp - pullrequest - live |
|
Azure Pipelines successfully started running 1 pipeline(s). |
colbytimm
pushed a commit
to colbytimm/microsoft-mcp
that referenced
this pull request
Dec 8, 2025
* Enable HTTP traces for self-hosted Azure MCP server * update changelog * formatting * fix doc comment * scope down the release preprocessor for only microsoft-owned telemetry * pr comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This pull request adds support for self-hosted telemetry using OpenTelemetry and Azure Monitor when the server is running in HTTP mode. It introduces a new method to configure a dedicated telemetry pipeline that exports traces to Application Insights, with environment-based controls for enabling or disabling telemetry collection. The implementation includes logic to filter out unwanted telemetry data to avoid duplication and feedback loops.
Telemetry and Observability Enhancements:
ConfigureSelfHostingTelemetry, which sets up OpenTelemetry tracing with Azure Monitor exporter for self-hosted HTTP scenarios. This is only enabled if the transport is HTTP, telemetry collection is not disabled by environment variable, and the Application Insights connection string is set.ShouldInstrumentHttpRequestto prevent instrumenting Application Insights ingestion requests and to avoid duplicate spans from Azure SDKs.Dependency Updates:
Azure.Monitor.OpenTelemetry.ExporterandOpenTelemetryfor telemetry instrumentation and exporting. [1] [2] [3]