fix(unit-only): Add aws-opentelemetry-distro to the MCP standalone pyproj... (#683)#48
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(unit-only): Add aws-opentelemetry-distro to the MCP standalone pyproj... (#683)#48aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
Add aws-opentelemetry-distro to the MCP standalone pyproject template and stop forcing instrumentation.enableOtel=false for MCP Python in the generate schema-mapper and import actions, so MCP Python runtimes get ADOT/OpenTelemetry tracing by default like HTTP Python agents. TypeScript stays excluded. Refresh asset snapshots. Refs aws#683
Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs aws#683
Issues
Root cause
The CLI explicitly writes instrumentation.enableOtel=false for MCP on all authoring paths (schema-mapper.ts:159, schema-mapper.ts:272, import/actions.ts:46), defeating the CDK construct's
?? truedefault at AgentCoreRuntime.ts:156-157 (verified at pinned ^alpha.19 and at alpha.39). The Zod schema default of true (agent-env.ts:106, mcp.ts:273) never applies because of the explicit false — so the 'already-fixed by defaults' reasoning is incorrect. The MCP standalone pyproject template (src/assets/python/mcp/standalone/base/pyproject.toml:11-13) also omits the otel distro that HTTP templates ship, so the two changes are genuinely coupled.The fix
Add aws-opentelemetry-distro to the MCP standalone pyproject template AND enable OTel for MCP Python by removing the explicit false at schema-mapper.ts:159/:272 and the MCP special-case at actions.ts:46; keep TypeScript excluded. Validate opentelemetry-instrument cleanly wraps the streamable-http MCP server and that the backend ingests MCP-runtime spans, then refresh asset snapshots.
Files touched: src/cli/operations/agent/generate/schema-mapper.ts:159 and :272; src/cli/commands/import/actions.ts:46; src/assets/python/mcp/standalone/base/pyproject.toml (add aws-opentelemetry-distro); plus snapshot refresh in src/assets/tests/snapshots/
Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.