Skip to content

fix(server): enable OTel tracing export - #751

Draft
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:otel-fixes
Draft

fix(server): enable OTel tracing export#751
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:otel-fixes

Conversation

@Ladas

@Ladas Ladas commented Aug 14, 2026

Copy link
Copy Markdown

Problem

Two bugs prevent trace export when building with --features opentelemetry:

  1. init_tracing() return value (TracingGuard) was immediately dropped in main.rs, killing the Tokio runtime that the BatchSpanProcessor needs for gRPC export
  2. The opentelemetry feature flag only enabled the AI routing.select span creation but did NOT enable praxis-core/otel — the OTLP exporter was never compiled in

Fix

  • Store TracingGuard in let _tracing_guard so it lives for the process lifetime
  • Add features = ["otel"] to the praxis-core workspace dependency

Testing

Verified on KIND with OTel Collector + Tempo: 11 spans per AI request (root + 8 filter + upstream_exchange + response_body phase).

Store the TracingGuard return value from init_tracing() to keep the
Tokio runtime alive for the BatchSpanProcessor's async gRPC export.
Without this, the guard drops immediately and traces are silently lost.

Also enable the praxis-core 'otel' feature in workspace dependencies
so the OTLP exporter and tracing subscriber are compiled in when
building with --features opentelemetry.

Signed-off-by: Ladislav Smola <lsmola@redhat.com>

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Summary: The _tracing_guard fix in main.rs is correct and necessary. However, enabling praxis-core/otel unconditionally at the workspace level pulls OTel dependencies into every build, even when the opentelemetry feature is not requested.

Overall: One issue to address before merging.

Severity Count
Critical 0
Large 1
Medium 0

Comment thread Cargo.toml

# Praxis core dependencies
praxis-core = { version = "0.5.2", package = "praxis-proxy-core" }
praxis-core = { version = "0.5.2", package = "praxis-proxy-core", features = ["otel"] }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Large] This unconditionally enables praxis-core/otel for all 7 workspace crates that depend on praxis-core, pulling in the OTLP exporter and its transitive dependencies (gRPC/tonic, opentelemetry SDK, etc.) even when building without --features opentelemetry.

Revert this line to the featureless form:

praxis-core = { version = "0.5.2", package = "praxis-proxy-core" }

Then propagate the feature conditionally in server/Cargo.toml:

[features]
opentelemetry = ["praxis-ai-filters/opentelemetry", "praxis-core/otel"]

This keeps OTel opt-in while fixing the original bug.

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