Skip to content

fix(tracing): trust preconfigured provider for APMPlus - #813

Merged
warm-wm merged 1 commit into
volcengine:mainfrom
feng-95:fix/apmplus-global-provider
Aug 4, 2026
Merged

fix(tracing): trust preconfigured provider for APMPlus#813
warm-wm merged 1 commit into
volcengine:mainfrom
feng-95:fix/apmplus-global-provider

Conversation

@feng-95

@feng-95 feng-95 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Treat any non-ProxyTracerProvider global tracer provider that exists before VeADK initialization as externally managing the APMPlus trace pipeline.
  • Skip registering an explicitly supplied APMPlusExporter span processor in that case.
  • Keep the existing ENABLE_APMPLUS=true append behavior so VeADK can still initialize its APMPlus metric uploader; the appended exporter's trace processor is not registered because tracer initialization has already completed.
  • Preserve constructor-time manual APMPlus exporter registration when no global provider exists.

Why

When the OpenTelemetry plugin or application code has already installed a global tracer provider and sends traces through localhost:4318, VeADK must not add a second direct APMPlus trace pipeline. This is the minimal emergency fix and intentionally does not introduce the exporter register() mechanism.

Validation

  • .venv/bin/pytest tests/test_tracing.py -q — 8 passed.
  • Ruff check, Ruff format, git diff --check, pre-commit CI, gitleaks CI, and Python 3.10/3.12 unit-test CI all passed.
  • Preconfigured-provider matrix covers ENABLE_APMPLUS on/off × explicit exporter present/absent, including metric-uploader retention for the env-enabled cases.
  • Fresh E2E on commit 387a856 with a code-preconfigured global provider, ENABLE_APMPLUS=true, trace OTLP relay at localhost:4318, and metrics relay at localhost:4319:
    • trace 0b5f914a0297440948f592fea2f4aa64: 4 received spans, 4 unique spans, relay duplicate count 0, and APMPlus cloud query returned 4 spans;
    • exactly one trace export processor (localhost:4318) and zero VeADK direct APMPlus trace processors;
    • one APMPlus metric reader was installed; relay received the expected GenAI metrics and APMPlus cloud query returned gen_ai_chat_count=1 for the unique test service.

Known boundary

opentelemetry-instrument currently installs an empty global MeterProvider when OTEL_METRICS_EXPORTER=none. APMPlus cannot replace that provider, so this environment-specific metrics case is excluded from PR #813 acceptance; trace export remains correct and non-duplicated. This is independent of the global tracer-provider deduplication in this PR.

Follow-up

Exporter runtime registration and preserving explicitly supplied APMPlus exporters for metrics remain in the dependent Draft PR #810. After this PR merges, #810 will contain only the register increment.

@feng-95
feng-95 force-pushed the fix/apmplus-global-provider branch from 0f494f9 to 387a856 Compare August 4, 2026 14:45
@warm-wm
warm-wm merged commit ffbf295 into volcengine:main Aug 4, 2026
7 checks passed
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.

2 participants