bug(typescript): agentcore deploy sets up no ADOT/OTel instrumentation for TypeScript agents, silently dropping all 3p telemetry
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- aws, docker, node.js, typescript
- Lĩnh vực
- build-system, devops, observability, testing-qa
Hướng nghiên cứu
Bắt đầu với schema-mapper.ts, Dockerfile TypeScript, cả hai tệp package.json mẫu TypeScript và đường dẫn CodeZip trong src/lib/packaging/node.ts. Chạy các bài kiểm thử kết xuất Dockerfile hiện có và thêm phần bao phủ TypeScript được nêu. Hoàn tất nghĩa là các agent TypeScript của container và CodeZip cấu hình đường dẫn instrumentation được ghi trong tài liệu, đồng thời hành vi telemetry được xác minh cùng với dependency sidecar của Runtime trong #1270.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
agentcore deploy does not set up any OpenTelemetry / ADOT instrumentation for TypeScript agents. Python agents get zero-code instrumentation via opentelemetry-instrument; TypeScript agents get nothing at any layer. As a result, spans emitted by any 3p instrumentation library (Strands, Vercel AI SDK, or a user's own @opentelemetry/api calls) are silently dropped, and nothing appears in CloudWatch / X-Ray Transaction Search.
This is a regression, not a never-implemented feature — the wiring existed and was removed (see below).
Steps to Reproduce
agentcore create --language TypeScript --sdk Strands --protocol HTTP --build Containeragentcore deploy- Invoke the deployed agent so it produces LLM/tool calls
- Open CloudWatch → Application Signals / X-Ray Transaction Search and look for traces from the agent
Also observable statically, without deploying:
- Generated
Dockerfileends inCMD ["npx", "tsx", "main.ts"]— no instrumentation wrapper - Generated
package.jsoncontains no OTel SDK, only the no-op@opentelemetry/api
Expected Behavior
TypeScript agents get zero-code ADOT instrumentation at parity with Python, so that 3p instrumentation libraries emitting via @opentelemetry/api export to the collector and show up in CloudWatch without any application code changes.
Actual Behavior
No instrumentation is configured. Three independent gaps, each sufficient on its own to produce zero telemetry:
1. enableOtel is hardcoded off for TypeScript — src/cli/operations/agent/generate/schema-mapper.ts:284
const enableOtel = !isMcp && config.language !== 'TypeScript';
2. The TypeScript Dockerfile has no instrumentation branch at all — src/assets/container/typescript/Dockerfile:25
CMD ["npx", "tsx", "main.ts"]
Compare src/assets/container/python/Dockerfile:40-44, which does branch:
{{#if enableOtel}}
CMD ["opentelemetry-instrument", "python", "-m", "{{entrypoint}}"]
{{else}}
CMD ["python", "-m", "{{entrypoint}}"]
{{/if}}
Because no {{#if enableOtel}} block exists in the TS Dockerfile, setting instrumentation.enableOtel: true on a TypeScript agent has no effect — there is nothing for it to render. The schema at src/schema/schemas/agent-env.ts:194 defaults it to true and documents it as "the runtime entrypoint is wrapped with opentelemetry-instrument", which is silently untrue for TypeScript.
3. No OTel SDK dependency or bootstrap in the TS templates. src/assets/typescript/http/strands/base/package.json carries only @opentelemetry/api — the no-op API surface, which discards all spans unless a global provider is registered. src/assets/typescript/http/vercelai/base/package.json has no OTel dependency at all. Neither template registers a provider.
The CodeZip path is affected too: TS CodeZip builds are bundled with esbuild (src/lib/packaging/node.ts:95) and have no Dockerfile to hook, so they need the instrumentation applied via runtime env vars rather than a CMD change.
Origin of the regression
Commit 580cd10b — "fix(templates): remove OTEL, session storage, and gateway from TS templates", merged in #981 (2026-05-14) — removed the working implementation:
- deleted
src/assets/typescript/http/strands/base/otel-register.tsand thevercelaiequivalent, which registered aNodeTracerProvider+MeterProviderwith OTLP exporters - removed
import './otel-register.js';from bothmain.tsfiles - removed 7
@opentelemetry/*dependencies from bothpackage.jsonfiles - flipped
schema-mapper.tsto exclude TypeScript
The OTel removal was one commit inside a broader TS template/streaming PR, so it isn't visible from the PR title.
Interaction with #1270 (important)
Fixing the CLI alone is not sufficient to get traces into CloudWatch. Per #1270, AgentCore Runtime starts the ADOT collector sidecar on localhost:4318 only when it detects opentelemetry-instrument in the container entrypoint, which is Python-specific. A TypeScript entrypoint never matches, so nothing listens on :4318 and OTLP export fails silently even with a correctly registered SDK.
These two need to land together for end-to-end telemetry. Adopting a --require-based ADOT entrypoint (below) may also give the Runtime a detectable signal for starting the sidecar, which is worth confirming with the Runtime team.
Suggested fix
ADOT for Node exists and is current: @aws/[email protected]. True zero-code parity with Python is a NODE_OPTIONS=--require @aws/aws-distro-opentelemetry-node-autoinstrumentation/register entrypoint — a single dependency and no hand-maintained otel-register.ts, unlike the reverted implementation.
Touch points:
src/cli/operations/agent/generate/schema-mapper.ts:284— stop excluding TypeScriptsrc/assets/container/typescript/Dockerfile— add the{{#if enableOtel}}branch- both TS template
package.jsonfiles — add the ADOT distro dependency - TS CodeZip path — set the instrumentation env vars on the runtime (no Dockerfile to hook)
src/assets/__tests__/dockerfile-render.test.ts— currently only exercises the Python Dockerfile; add TS coverage so this cannot silently regress again
CLI Version
0.25.0 (repo package.json, at commit 8fba8160)
- Ngôn ngữ chính
- TypeScript
- Star
- 291
- Fork
- 96
- Merge trung bình
- 20 giờ 50 phút
- Pull request đã merge (30 ngày)
- 214
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/agentcore-cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
aws/agentcore-cli#2395 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
aws/agentcore-cli#2392 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws/agentcore-cli#2267 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/agentcore-cli#2258 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/agentcore-cli#2176 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/agentcore-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
melgarafael/DeskcommCRM#1812 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
prisma/prisma-cli#309 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gregwebs/pi-quota-dispatcher#26 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
openwatersio/slackwater.xyz#124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-reported area/browser area/docs documentation good first issue hacktoberfest help wanted P2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 2 ngày