Skip to content

Conversation

xiaomi7732
Copy link
Member

@xiaomi7732 xiaomi7732 commented Oct 1, 2025

What does this PR do?

Add a tool to ApplicationInsights for query the trace.

This is the first piece, and simple query tool to query user's application insights trace data by running KQL queries.

GitHub issue number?

#671

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
    • Updated command list in /docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • 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 /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

@xiaomi7732 xiaomi7732 marked this pull request as ready for review October 2, 2025 23:12
@xiaomi7732 xiaomi7732 requested review from a team, jongio and srnagar as code owners October 2, 2025 23:12
@Copilot Copilot AI review requested due to automatic review settings October 2, 2025 23:12
Copy link
Contributor

@Copilot 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 a tool to ApplicationInsights for querying trace data by running KQL queries. It introduces the first piece of functionality to query user's Application Insights trace data using the azmcp_applicationinsights_apptrace_list command.

  • Added new AppTraceListCommand for listing distributed trace metadata from Application Insights components
  • Implemented KQL query building service for constructing Application Insights queries
  • Added service layer for executing Azure Monitor Log queries against Application Insights resources

Reviewed Changes

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

Show a summary per file
File Description
tools/Azure.Mcp.Tools.ApplicationInsights/src/Commands/AppTrace/AppTraceListCommand.cs New command implementation for listing Application Insights traces
tools/Azure.Mcp.Tools.ApplicationInsights/src/Services/KQLQueryBuilder.cs KQL query builder service for constructing Application Insights queries
tools/Azure.Mcp.Tools.ApplicationInsights/src/Services/ApplicationInsightsService.cs Updated service to support distributed trace listing functionality
tools/Azure.Mcp.Tools.ApplicationInsights/src/ApplicationInsightsSetup.cs Registered new services and commands in DI container
core/Azure.Mcp.Core/src/Services/Azure/Resource/ResourceResolverService.cs Moved ResourceResolverService to core namespace for reuse
servers/Azure.Mcp.Server/README.md Updated documentation with new Application Insights trace commands
docs/azmcp-commands.md Added documentation for new apptrace list command
Comments suppressed due to low confidence (1)

tools/Azure.Mcp.Tools.ApplicationInsights/src/Commands/AppTrace/AppTraceListCommand.cs:1

  • The description section contains inconsistent formatting with escaped quotes and mixed single/double quotes that could confuse users reading the help text.
// Copyright (c) Microsoft Corporation.

@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure MCP Server Oct 2, 2025
@xiaomi7732 xiaomi7732 force-pushed the users/saars/AddAppInsights-ListAppTraces branch from aa242cf to 65371ee Compare October 3, 2025 22:49
@xiaomi7732 xiaomi7732 requested a review from jongio October 6, 2025 16:57
@xiaomi7732 xiaomi7732 self-assigned this Oct 7, 2025
@xiaomi7732 xiaomi7732 added the tools-ApplicationInsights Application Insights label Oct 7, 2025
@xiaomi7732 xiaomi7732 force-pushed the users/saars/AddAppInsights-ListAppTraces branch from 65371ee to b99da41 Compare October 8, 2025 19:14
@xiaomi7732 xiaomi7732 requested a review from jongio October 8, 2025 21:38
@xiaomi7732 xiaomi7732 force-pushed the users/saars/AddAppInsights-ListAppTraces branch 3 times, most recently from 4a241f8 to 07a7760 Compare October 9, 2025 22:09
@xiaomi7732 xiaomi7732 force-pushed the users/saars/AddAppInsights-ListAppTraces branch from 4948323 to 74ddf1d Compare October 13, 2025 18:12
@xiaomi7732 xiaomi7732 requested a review from hallipr October 13, 2025 18:24
@xiaomi7732
Copy link
Member Author

@jongio / @hallipr Mind give it another approval, please.

@g2vinay g2vinay added the Do Not Merge Do Not Merge / WIP PRs label Oct 13, 2025
@joshfree joshfree added this to the 2025-11 milestone Oct 14, 2025
@joshfree
Copy link
Member

@srnagar it looks like this missed the October release window. Please help ensure this gets merged for the November release on day-1

| join kind=leftouter ({{remainingQueries[2]}}) on operation_Id
| summarize sum(itemCount), arg_min(ai_hash(operation_Id), operation_Id, column_ifexists("id", '')) by itemType, operation_Name, resultCode, problemId, target, type, resultCode1, name, location
| summarize traces=make_list(bag_pack('traceId', operation_Id, 'spanId', column_ifexists("id", '')), 3), sum(sum_itemCount) by itemType, {{keyDimensions}}
| top 10 by sum_sum_itemCount desc
Copy link
Member

Choose a reason for hiding this comment

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

Should we update documentation to mention that this returns the top 10 results? Do we plan to make this a customizable option on how many results we return?

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

Labels

Do Not Merge Do Not Merge / WIP PRs tools-ApplicationInsights Application Insights

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

7 participants