Skip to content

Conversation

rgupta2205
Copy link
Contributor

@rgupta2205 rgupta2205 commented Oct 8, 2025

Add CloudWatch Synthetics Canary Analysis to Application Signals MCP Server

Summary

Changes

Extended the CloudWatch Application Signals MCP Server with comprehensive CloudWatch Synthetics canary analysis capabilities:

  • New canary_utils.py: Utility functions for canary failure analysis, IAM role validation, artifact retrieval, and debugging
  • Enhanced server.py: Added analyze_canary_failures tool for comprehensive canary failure investigation
  • Updated aws_clients.py: Added Synthetics, S3, IAM, Lambda, and STS clients; cleaned up debug logging
  • Updated README.md: Added documentation for canary analysis capabilities
  • Added comprehensive tests: 21 test scenarios covering real-world canary failure patterns in test_canary_utils.py

User experience

Before: Users could only analyze Application Signals metrics and traces, with no visibility into CloudWatch Synthetics canary failures

After: Users can now:

  • Analyze canary failures with comprehensive root cause identification
  • Check IAM role configurations and permissions for canaries
  • Retrieve and analyze canary artifacts (logs, screenshots, HAR files)
  • Get actionable recommendations for resolving canary issues
  • Correlate canary failures with Application Signals telemetry data
  • Handle edge cases like S3 access errors, connection timeouts, browser target issues, and VPC configuration problems

Key Features Added

  • Comprehensive failure analysis with pattern recognition for common canary issues
  • IAM role and policy validation with specific permission checks
  • Artifact analysis including HAR files, screenshots, and logs
  • APM Pulse integration for enhanced diagnostics
  • 21 comprehensive test scenarios covering real-world failure patterns
  • Robust error handling for AWS API failures and edge cases

Checklist

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested (21/21 tests passing)
  • Changes are documented

Is this a breaking change? (Y/N) N

RFC issue number: N/A

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

Reference: https://quip-amazon.com/J1eLAngUZYMB/Cloudwatch-Synthetics-MCP-Server-using-API

Testing
image
image
image

@rgupta2205 rgupta2205 changed the title Adding Synthetics Capability to Application Signals MCP server feat: Add CloudWatch Synthetics Canary Analysis to Application Signals MCP Server Oct 8, 2025
Copy link

codecov bot commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 90.35326% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.49%. Comparing base (a7e8cb9) to head (e689f49).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...s/cloudwatch_appsignals_mcp_server/canary_utils.py 91.71% 13 Missing and 26 partials ⚠️
...awslabs/cloudwatch_appsignals_mcp_server/server.py 87.20% 8 Missing and 24 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1471      +/-   ##
==========================================
+ Coverage   89.48%   89.49%   +0.01%     
==========================================
  Files         729      730       +1     
  Lines       50584    51317     +733     
  Branches     7990     8164     +174     
==========================================
+ Hits        45265    45928     +663     
- Misses       3453     3474      +21     
- Partials     1866     1915      +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Rahul Gupta and others added 9 commits October 14, 2025 16:25
- Added missing AWS client mocks for canary_utils module (lambda_client, logs_client, synthetics_client)
- Renamed conflicting mock_aws_clients fixture in test_canary_utils.py to mock_canary_clients
- Fixed fixture isolation issues that caused canary tests to fail with authentication errors
- All 28 canary failure analysis tests now pass consistently
- Improved test coverage from 383/389 to 387/389 tests passing (96% → 99.5% pass rate)
Copy link
Contributor

@yiyuan-he yiyuan-he left a comment

Choose a reason for hiding this comment

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

Why are there so many new changes? Previously the PR was ~2K lines of code changes and now it is approaching 7K

@rgupta2205
Copy link
Contributor Author

rgupta2205 commented Oct 14, 2025

Why are there so many new changes? Previously the PR was ~2K lines of code changes and now it is approaching 7K

Just adding more unit test as it's (88.99% of diff hit (target 89.48%)) which causing check failure

@yiyuan-he
Copy link
Contributor

Just adding more unit test as it's (88.99% of diff hit (target 89.48%)) which causing check failure

~0.5% additional test coverage results in 5K more lines of code?

@rgupta2205
Copy link
Contributor Author

Just adding more unit test as it's (88.99% of diff hit (target 89.48%)) which causing check failure

~0.5% additional test coverage results in 5K more lines of code?

Originally it was in 35%

@rgupta2205 rgupta2205 requested a review from yiyuan-he October 14, 2025 20:16
Copy link
Contributor

@mxiamxia mxiamxia left a comment

Choose a reason for hiding this comment

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

LGTM now. Thx

Copy link
Contributor

@yiyuan-he yiyuan-he left a comment

Choose a reason for hiding this comment

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

LGTM ty

@rgupta2205 rgupta2205 closed this Oct 14, 2025
@github-project-automation github-project-automation bot moved this from To triage to Done in awslabs/mcp Project Oct 14, 2025
@rgupta2205 rgupta2205 reopened this Oct 14, 2025
@yiyuan-he yiyuan-he added this pull request to the merge queue Oct 14, 2025
Merged via the queue into awslabs:main with commit 946b346 Oct 14, 2025
271 checks passed
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.

3 participants