Skip to content

Support log telemetry for user's AppInsight instance#1638

Merged
srnagar merged 11 commits intomicrosoft:mainfrom
srnagar:telemetry-logs
Feb 5, 2026
Merged

Support log telemetry for user's AppInsight instance#1638
srnagar merged 11 commits intomicrosoft:mainfrom
srnagar:telemetry-logs

Conversation

@srnagar
Copy link
Member

@srnagar srnagar commented Feb 3, 2026

What does this PR do?

This pull request refactors how OpenTelemetry is configured for Azure Monitor exporters, separating the logic for Microsoft-owned and user-provided Application Insights instances. It introduces clearer method naming and a new constants class to distinguish between telemetry destinations, and moves logger configuration to be handled exclusively in Azure Monitor setup.

Telemetry configuration refactoring:

  • Split the generic ConfigureAzureMonitorExporter method into two specialized methods: ConfigureMicrosoftAzureMonitorExporter and ConfigureUserProvidedAzureMonitorExporter, making the configuration for Microsoft and user-provided telemetry more explicit (OpenTelemetryExtensions.cs).
  • Updated the logic in EnableAzureMonitor to call the new specialized configuration methods based on the telemetry destination (OpenTelemetryExtensions.cs) [1] [2].

Constants and naming improvements:

  • Added a new AppInsightsInstanceType class to define constants for distinguishing between Microsoft and user-provided Application Insights instances (TelemetryConstants.cs).
  • Updated exporter configuration to use the new AppInsightsInstanceType constants for naming exporters instead of passing string literals (OpenTelemetryExtensions.cs) [1] [2].

Logger configuration changes:

  • Removed OpenTelemetry logger setup from ConfigureOpenTelemetryLogger and moved logger configuration to be handled within Azure Monitor setup, preventing duplicate configuration (OpenTelemetryExtensions.cs).

GitHub issue number?

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

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 tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • 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

@srnagar srnagar requested review from a team as code owners February 3, 2026 19:06
Copilot AI review requested due to automatic review settings February 3, 2026 19:06
@github-project-automation github-project-automation bot moved this to Untriaged in Azure MCP Server Feb 3, 2026
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 refactors OpenTelemetry configuration to separate the setup logic for Microsoft-owned and user-provided Application Insights instances. The changes introduce clearer method naming through specialized configuration methods and add a new constants class to distinguish between telemetry destinations.

Changes:

  • Splits generic Azure Monitor exporter configuration into two specialized methods: one for Microsoft telemetry and one for user-provided telemetry
  • Introduces AppInsightsInstanceType constants class to standardize naming for telemetry destinations
  • Removes OpenTelemetry logger setup from ConfigureOpenTelemetryLogger, with logging now only configured for user-provided Application Insights

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
core/Microsoft.Mcp.Core/src/Commands/TelemetryConstants.cs Adds new AppInsightsInstanceType class with constants for Microsoft and UserProvided telemetry destinations
core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs Refactors Azure Monitor configuration into two specialized methods, removes logger setup from ConfigureOpenTelemetryLogger, and updates exporter naming to use new constants

@srnagar srnagar changed the title Telemetry logs Support log telemetry for user's AppInsight instance Feb 3, 2026
@srnagar srnagar self-assigned this Feb 3, 2026
@srnagar srnagar moved this from Untriaged to In Progress in Azure MCP Server Feb 3, 2026
@srnagar srnagar added this to the 2026-02 milestone Feb 3, 2026
srnagar and others added 2 commits February 3, 2026 11:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@srnagar srnagar enabled auto-merge (squash) February 4, 2026 22:09
@srnagar srnagar merged commit 7f4c894 into microsoft:main Feb 5, 2026
14 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants