Skip to content

Fix SDK OpenTelemetry opt-in behavior#567

Merged
rbarbadillo merged 1 commit into
mainfrom
rbarbadillo/no-ootb-otel-without-env
Jun 16, 2026
Merged

Fix SDK OpenTelemetry opt-in behavior#567
rbarbadillo merged 1 commit into
mainfrom
rbarbadillo/no-ootb-otel-without-env

Conversation

@rbarbadillo

@rbarbadillo rbarbadillo commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

This fixes SDK OpenTelemetry opt-in behavior when an application already has a global OpenTelemetry provider configured.

The SDK now emits Mistral SDK GenAI spans only when Mistral telemetry is explicitly enabled, for example with MISTRAL_SDK_TELEMETRY=global or a per-client telemetry provider. Application-owned HTTP instrumentation continues to behave independently.

Behavior

  • No MISTRAL_SDK_TELEMETRY: no Mistral SDK GenAI span is emitted.
  • MISTRAL_SDK_TELEMETRY=false: no Mistral SDK GenAI span is emitted.
  • MISTRAL_SDK_TELEMETRY=global: SDK GenAI spans use the application’s global OpenTelemetry provider.
  • Custom/per-client tracer providers continue to work as before.

Testing

PYTHONPATH=src:packages/azure/src:packages/gcp/src .venv/bin/python -m ruff check \
  src/mistralai/client/_hooks/tracing.py \
  src/mistralai/extra/observability/telemetry.py \
  src/mistralai/extra/tests/test_otel_tracing.py

PYTHONPATH=src:packages/azure/src:packages/gcp/src .venv/bin/python -m pytest \
  src/mistralai/extra/tests/test_telemetry.py \
  src/mistralai/extra/tests/test_otel_tracing.py

@rbarbadillo rbarbadillo self-assigned this Jun 15, 2026
@rbarbadillo rbarbadillo requested a review from Yousria June 15, 2026 16:51
@rbarbadillo rbarbadillo marked this pull request as ready for review June 15, 2026 16:51
@rbarbadillo rbarbadillo requested a review from th-ch June 16, 2026 07:12
@rbarbadillo rbarbadillo merged commit 5efa8ce into main Jun 16, 2026
11 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