Skip to content

Enable telemetry for HTTP mode #1150

Merged
srnagar merged 10 commits intomicrosoft:mainfrom
srnagar:remote-telemetry
Nov 13, 2025
Merged

Enable telemetry for HTTP mode #1150
srnagar merged 10 commits intomicrosoft:mainfrom
srnagar:remote-telemetry

Conversation

@srnagar
Copy link
Copy Markdown
Member

@srnagar srnagar commented Nov 11, 2025

What does this PR do?

This pull request refactors and enhances the configuration of Azure Monitor (Application Insights) telemetry exporters in the OpenTelemetryExtensions class. The changes allow support for multiple exporters, improve environment variable handling, and simplify telemetry enablement logic.

Azure Monitor Exporter Configuration Improvements:

  • Refactored to support multiple Azure Monitor exporters by collecting connection strings from both user-provided and Microsoft-provided sources, and introduced a new method ConfigureMultipleAzureMonitorExporters to register each exporter for logging, metrics, and tracing. [1] [2]
  • Changed the default Application Insights connection string constant name from DefaultAppInsights to DefaultAppInsightsConnectionString for clarity.

Telemetry Enablement Logic Simplification:

  • Simplified the logic for enabling telemetry by removing the check for the transport type and basing the decision solely on the AZURE_MCP_COLLECT_TELEMETRY environment variable.

Environment Variable Handling:

  • Removed redundant fallback logic for the Application Insights connection string, deferring the selection and prioritization to the new exporter configuration logic.

GitHub issue number?

https://github.com/microsoft/mcp-pr/issues/148

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copy link
Copy Markdown
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 enables telemetry collection for HTTP transport mode by refactoring the Azure Monitor exporter configuration to support multiple exporters and simplifying the telemetry enablement logic.

Key changes:

  • Removed the transport-specific telemetry check, allowing telemetry to be collected regardless of transport mode (stdio or HTTP)
  • Introduced support for multiple Azure Monitor exporters with separate user-provided and Microsoft telemetry collection streams
  • Added a new environment variable AZURE_MCP_COLLECT_TELEMETRY_MICROSOFT to control Microsoft-specific telemetry collection

Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs
Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs
@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure MCP Server Nov 13, 2025
Copy link
Copy Markdown
Member

@vukelich vukelich left a comment

Choose a reason for hiding this comment

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

Small comments.

Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs Outdated
Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs Outdated
Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs
Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs
@srnagar srnagar enabled auto-merge (squash) November 13, 2025 05:10
Copy link
Copy Markdown
Member

@vukelich vukelich left a comment

Choose a reason for hiding this comment

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

Minor comments. Do or skip.

Comment thread servers/Azure.Mcp.Server/README.md
Comment thread servers/Azure.Mcp.Server/README.md
@srnagar srnagar merged commit 256f677 into microsoft:main Nov 13, 2025
55 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Nov 13, 2025
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Dec 8, 2025
* Enable telemetry for HTTP mode

* introduce env var to disable telemetry to microsoft

* update connection string

* update env var name

* remove console logs

* update method name

* pr comments

* Update changelog and README

* merge from main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants