Skip to content

fix: agentcore dev overrides otel env vars#1741

Closed
avi-alpert wants to merge 1 commit into
aws:mainfrom
avi-alpert:aalpert/otel-override
Closed

fix: agentcore dev overrides otel env vars#1741
avi-alpert wants to merge 1 commit into
aws:mainfrom
avi-alpert:aalpert/otel-override

Conversation

@avi-alpert

@avi-alpert avi-alpert commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

agentcore dev unconditionally starts a built-in OTLP collector and sets OTEL_EXPORTER_OTLP_ENDPOINT to point at it. This overwrites any pre-existing endpoint the user has configured (e.g., for forwarding traces to their own collector.

Previously the only workaround was --no-traces, which is confusing since the user does want tracing — just not our built-in collector.

Fix: Before starting the built-in collector, check if OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is already set in the environment. If either is present, skip starting our collector and don't inject our OTLP env vars — let the user's configuration pass through to the agent process.

Related Issue

Closes #1009

Type of Change

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

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Manual test:

# Collector starts normally (no env var set):
agentcore dev -l --skip-deploy
# → "OTEL collector listening on port ..."

# Collector skipped when endpoint is pre-configured:
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:9999 agentcore dev -l --skip-deploy
# → No collector started, spans go to user's endpoint

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

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

@github-actions github-actions Bot added the size/s PR size: S label Jul 10, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 10, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 10, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 10, 2026
@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 Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.24.0.tgz

How to install

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

@avi-alpert avi-alpert closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a flag to allow pushing traces to custom OTEL endpoint

1 participant