Skip to content

Conversation

@srnagar
Copy link
Member

@srnagar srnagar commented Nov 5, 2025

What does this PR do?

This pull request introduces an important change to how telemetry is enabled for the Azure MCP Server. Telemetry collection is now automatically disabled when the server is running with HTTP transport, ensuring that telemetry is only collected for the default (stdio) transport. This change is reflected in both the configuration logic and the documentation. Additionally, there are minor code cleanups and updates to launch settings.

Telemetry configuration changes:

  • Telemetry is now disabled for HTTP transport by updating the logic in OpenTelemetryExtensions.ConfigureOpenTelemetry to check the ServiceStartOptions.Transport property and only enable telemetry for stdio transport.
  • The change is documented in the changelog with a new entry: "Disabled telemetry for HTTP transport".

Configuration and code cleanup:

  • Updated the launch profile in launchSettings.json to use the new --transport http flag for clarity and consistency.
  • Removed unused imports from ServiceStartCommand.cs and OpenTelemetryExtensions.cs for cleaner code. [1] [2]

These changes help ensure telemetry is only collected when appropriate and improve the maintainability of the codebase.

GitHub issue number?

[Link to the GitHub issue this PR addresses]

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

@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Nov 5, 2025
@joshfree joshfree added this to the 2025-11 milestone Nov 5, 2025
Copy link
Member

@joshfree joshfree left a comment

Choose a reason for hiding this comment

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

This works, but I think you could have just done an #ifdef HTTP and set options.IsTelemetryEnabled = false;

@joshfree
Copy link
Member

joshfree commented Nov 6, 2025

This works, but I think you could have just done an #ifdef HTTP and set options.IsTelemetryEnabled = false;

@anuchandy PTAL

@srnagar srnagar marked this pull request as ready for review November 6, 2025 18:22
@srnagar srnagar requested review from a team as code owners November 6, 2025 18:22
@srnagar srnagar enabled auto-merge (squash) November 6, 2025 18:22
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 disables telemetry collection when the Azure MCP server is running in HTTP transport mode. The change ensures telemetry is only collected for stdio transport connections.

  • Updated the telemetry configuration logic to check the transport type and disable telemetry for HTTP transport
  • Modified the debug launch settings to use the new --transport http flag instead of the deprecated --run-as-remote-http-service flag
  • Updated the CHANGELOG to document the telemetry behavior change

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs Added logic to disable telemetry when transport is HTTP; removed unused imports
servers/Azure.Mcp.Server/src/Properties/launchSettings.json Updated debug profile to use --transport http flag
servers/Azure.Mcp.Server/CHANGELOG.md Added changelog entry for telemetry behavior change
core/Azure.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs Removed unused import

@srnagar srnagar merged commit 737a7ef into microsoft:main Nov 6, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server Nov 6, 2025
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