Skip to content

fix(templates): add ADOT instrumentation to TypeScript templates - #2892

Open
jariy17 wants to merge 1 commit into
v1.xfrom
fix/adot-typescript-templates
Open

jariy17 wants to merge 1 commit into
v1.xfrom
fix/adot-typescript-templates

Conversation

@jariy17

@jariy17 jariy17 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

TypeScript agents created from agent-typescript-strands and agent-typescript-vercel send no traces. Neither template installs an OpenTelemetry SDK. Strands carries only @opentelemetry/api, which drops spans unless a provider is registered, and Vercel carries nothing. agentcore traces runtime list prints No traces found for these agents however long you wait.

This ports the template half of #1893 (v0.x) to v1.x. The Runtime half, preloading the distro through NODE_OPTIONS on Node CodeZip Runtimes, is aws/agentcore-l3-cdk-constructs#479.

  • Both templates add @aws/aws-distro-opentelemetry-node-autoinstrumentation ~0.14.0.
  • Strands template adds overrides pinning @opentelemetry/exporter-metrics-otlp-http and @opentelemetry/exporter-trace-otlp-http to 0.219.0. Strands 1.5 declares them as ^0.214.0 optional peers, and the distro needs 0.219.0. Without the overrides, npm install in a new project fails with ERESOLVE. --legacy-peer-deps is not a workaround: it also drops @modelcontextprotocol/sdk, and the bundle then fails to build.
  • Vercel template sets experimental_telemetry on streamText, gated on AGENT_OBSERVABILITY_ENABLED === 'true'. The distro's Vercel instrumentation patches ai at import time, but esbuild inlines ai into the CodeZip bundle, so there is no import left to patch. The SDK's own telemetry reports to the global tracer the distro registers.

The .ts and package.json changes are the whole CLI diff; --help, --json and agentcore.json are unchanged.

Related Issue

Closes #1892

Documentation PR

Not applicable: no command, flag or config change.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran bun test (5494 passed)
  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not applicable
    (CI does not run them for you). Not run as a suite. See the live run below; the trace assertion needs the L3 release.
  • I ran bun run typecheck
  • I ran bun run lint:check
  • I ran bun run format:check
  • I ran bun run audit (no vulnerabilities, 570 packages)
  • I ran bun run secrets:check
  • I ran bun run build
  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and committed them. No snapshot covers these files; the project.test.ts dependency list is updated.
  • If I re-recorded fixtures or golden files, every change beyond account identifiers is explained
    by this PR. None re-recorded.
  • This PR does not change command.md (the release workflow regenerates it)

Live, in us-east-1, with this branch built and the L3 PR vended in:

  • Both templates scaffold with a plain npm install.
  • Both deploy, and 5/5 invokes each.
  • ADOT starts on every session, and X-Ray has 5 traces for each.
  • agentcore traces runtime list --name agent lists them.
  • Strands spans: invoke_agent, chat, execute_tool. Vercel spans: chat <model> with gen_ai.* attributes.

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published: needs the @aws/agentcore-cdk release carrying aws/agentcore-l3-cdk-constructs#479. Until the pin in src/assets/cdk/package.json moves to it, new projects install the distro but nothing preloads it.

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

@jariy17
jariy17 force-pushed the fix/adot-typescript-templates branch from e077503 to eeafeea Compare November 30, 2026 21:56
@jariy17
jariy17 marked this pull request as ready for review November 30, 2026 21:56
@jariy17
jariy17 requested a review from a team November 30, 2026 21:56
@github-actions github-actions Bot added size/xs PR size: XS and removed size/xs PR size: XS labels Nov 30, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.73%. Comparing base (a6f14f3) to head (eeafeea).

Additional details and impacted files
@@           Coverage Diff           @@
##             v1.x    #2892   +/-   ##
=======================================
  Coverage   96.73%   96.73%           
=======================================
  Files         747      747           
  Lines       62845    62845           
=======================================
  Hits        60793    60793           
  Misses       2052     2052           

☔ View full report in Codecov by Harness.
📢 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.

@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-1.4.0.tgz

How to install

gh release download pr-2892-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-1.4.0.tgz

@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026

This branch has not been deployed

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

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(typescript): agentcore deploy sets up no ADOT/OTel instrumentation for TypeScript agents, silently dropping all 3p telemetry

2 participants