Skip to content

Add ToolId to telemetry and support local telemetry#1018

Merged
alzimmermsft merged 6 commits intomicrosoft:mainfrom
alzimmermsft:AddToolGuid
Nov 3, 2025
Merged

Add ToolId to telemetry and support local telemetry#1018
alzimmermsft merged 6 commits intomicrosoft:mainfrom
alzimmermsft:AddToolGuid

Conversation

@alzimmermsft
Copy link
Copy Markdown
Contributor

What does this PR do?

Changes how tools are executed to support adding ToolId into every telemetry call for a specific tool.

Adds support for AZURE_MCP_ENABLE_OTLP_EXPORTER environment variable to enable OTLP in addition to Azure Monitor telemetry exporting.

GitHub issue number?

Fixes https://github.com/microsoft/mcp-pr/issues/136
Fixes #1004

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

Comment thread core/Azure.Mcp.Core/src/Commands/IBaseCommand.cs Outdated
@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Oct 31, 2025
@alzimmermsft alzimmermsft marked this pull request as ready for review October 31, 2025 20:06
@alzimmermsft alzimmermsft requested review from a team as code owners October 31, 2025 20:06
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 adds telemetry support for tracking tool IDs and enables optional OTLP (OpenTelemetry Protocol) export functionality.

Key changes:

  • Added ToolId tag to track unique tool identifiers in telemetry
  • Implemented conditional OTLP exporter based on environment variable
  • Set ToolId tag in all tool execution paths (CommandFactory, NamespaceToolLoader, CommandFactoryToolLoader)

Reviewed Changes

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

Show a summary per file
File Description
TelemetryConstants.cs Added new ToolId constant for telemetry tag naming
OpenTelemetryExtensions.cs Added OTLP exporter configuration with environment variable flag and stored builder reference
CommandFactory.cs Set ToolId tag on activity when executing commands
NamespaceToolLoader.cs Set ToolId tag on activity for namespace tool execution and removed unused import
CommandFactoryToolLoader.cs Set ToolId tag on activity for command factory tool execution and removed unused import

Comment thread core/Azure.Mcp.Core/src/Extensions/OpenTelemetryExtensions.cs
Comment thread core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/NamespaceToolLoader.cs Outdated
Copy link
Copy Markdown
Member

@conniey conniey left a comment

Choose a reason for hiding this comment

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

Lgtm

@alzimmermsft alzimmermsft merged commit 233ecf8 into microsoft:main Nov 3, 2025
24 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Nov 3, 2025
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Dec 8, 2025
* Add ToolId to telemetry and support local telemetry

* Change how ToolId is set

* using cleanup

* Fix copy-paste error

* CHANGELOG and troubleshooting
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.

Include Tool GUID in telemetry

4 participants