Skip to content

feat: auto-detect and mutually exclude native vs third-party agentic instrumentors#729

Merged
wangzlei merged 3 commits intoaws-observability:mainfrom
wangzlei:feat/auto-detect-agentic-instrumentation
Apr 23, 2026
Merged

feat: auto-detect and mutually exclude native vs third-party agentic instrumentors#729
wangzlei merged 3 commits intoaws-observability:mainfrom
wangzlei:feat/auto-detect-agentic-instrumentation

Conversation

@wangzlei
Copy link
Copy Markdown
Contributor

@wangzlei wangzlei commented Apr 21, 2026

Summary

  • Remove AWS_AGENTIC_OBSERVABILITY_OPT_IN logic and related code introduced in 0.17, restore v0.15 is_agent_observability_enabled() as the sole legacy toggle
  • When AGENT_OBSERVABILITY_ENABLED=true, auto-detect registered third-party agentic instrumentors (e.g. OpenInference) and mutually exclude them with AWS native ones to prevent double instrumentation
  • Add AWS_AGENTIC_INSTRUMENTATION_OPT_IN env var to let users override auto-detection and force AWS native instrumentors

Use Cases

Case 1: New user, only ADOT installed (no OpenInference)

  • Sets AGENT_OBSERVABILITY_ENABLED=true
  • No third-party instrumentors detected → AWS native (aws_langchain, aws_crewai, etc.) auto-enabled
  • Zero additional configuration needed

Case 2: Existing user with ADOT + OpenInference

  • Sets AGENT_OBSERVABILITY_ENABLED=true
  • Auto-detect finds langchain, crewai etc. entry points from OpenInference
  • AWS native equivalents (aws_langchain, aws_crewai) are disabled automatically
  • OpenInference continues to work, no breaking change

Case 3: User wants to migrate from OpenInference to AWS native

  • Sets AGENT_OBSERVABILITY_ENABLED=true + AWS_AGENTIC_INSTRUMENTATION_OPT_IN=true
  • Even though OpenInference is still installed, third-party instrumentors are disabled
  • AWS native instrumentors take over
  • User can uninstall OpenInference at their convenience

Case 4: Non-agentic user

  • Does not set AGENT_OBSERVABILITY_ENABLED → entire agentic logic skipped, no impact

Case 5: User with custom OTEL_PYTHON_DISABLED_INSTRUMENTATIONS

  • User-provided disabled list is preserved (setdefault)
  • Mutual exclusion disables are appended on top of user's value

Test plan

  • Unit tests: 936 passed, 0 failures
  • Coverage: aws_opentelemetry_distro.py at 100%
  • Lint: black, flake8, isort all pass
  • Contract tests
  • Manual validation with OpenInference installed

@wangzlei wangzlei requested a review from a team as a code owner April 21, 2026 23:52
@wangzlei wangzlei force-pushed the feat/auto-detect-agentic-instrumentation branch 2 times, most recently from 84ea188 to 1c1a43a Compare April 22, 2026 00:15
@wangzlei wangzlei enabled auto-merge (squash) April 22, 2026 18:02
@wangzlei wangzlei force-pushed the feat/auto-detect-agentic-instrumentation branch from 1c1a43a to 00ecc61 Compare April 22, 2026 23:20
@wangzlei wangzlei force-pushed the feat/auto-detect-agentic-instrumentation branch 2 times, most recently from b819bdc to 036a615 Compare April 23, 2026 00:09
… agentic instrumentors

When AGENT_OBSERVABILITY_ENABLED=true, auto-detect registered third-party
instrumentors (e.g. OpenInference) and disable conflicting AWS native ones
to prevent double instrumentation.

Add AWS_AGENTIC_INSTRUMENTATION_OPT_IN env var to let users override
auto-detection and force AWS native instrumentors over third-party ones.
@wangzlei wangzlei force-pushed the feat/auto-detect-agentic-instrumentation branch from 036a615 to 821b24b Compare April 23, 2026 01:42
@wangzlei wangzlei merged commit 02ada61 into aws-observability:main Apr 23, 2026
18 checks passed
liustve added a commit to aws-observability/aws-application-signals-test-framework that referenced this pull request Apr 23, 2026
- Aligns genai v1 and v2 E2E test Terraform with changes from
[aws-otel-python-instrumentation#729](aws-observability/aws-otel-python-instrumentation#729).
liustve added a commit that referenced this pull request Apr 23, 2026
…cs endpoints (#732)

*Description of changes:*
- Restore the `OTEL_EXPORTER_OTLP_ENDPOINT` guard that was dropped in
#729
- When the base `OTEL_EXPORTER_OTLP_ENDPOINT` is set (e.g. to a local
collector), skip defaulting `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and
`OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` to the direct-to-AWS URLs so the OTel
SDK honors the base URL
liustve added a commit to aws-observability/aws-otel-js-instrumentation that referenced this pull request Apr 27, 2026
…instrumentors (#417)

parities:
aws-observability/aws-otel-python-instrumentation#729

- Checks existing downloaded packages, if a conflict is found, the ADOT
instrumentation skips itself instead of producing duplicate spans.

- AWS_AGENTIC_INSTRUMENTATION_OPT_IN=true overrides the detection and
forces ADOT instrumentations to enable regardless of third-party
presence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants