fix(server): enable OTel tracing export - #751
Conversation
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
left a comment
There was a problem hiding this comment.
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 |
|
|
||
| # 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"] } |
There was a problem hiding this comment.
[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.
Problem
Two bugs prevent trace export when building with
--features opentelemetry:init_tracing()return value (TracingGuard) was immediately dropped inmain.rs, killing the Tokio runtime that theBatchSpanProcessorneeds for gRPC exportopentelemetryfeature flag only enabled the AIrouting.selectspan creation but did NOT enablepraxis-core/otel— the OTLP exporter was never compiled inFix
TracingGuardinlet _tracing_guardso it lives for the process lifetimefeatures = ["otel"]to thepraxis-coreworkspace dependencyTesting
Verified on KIND with OTel Collector + Tempo: 11 spans per AI request (root + 8 filter + upstream_exchange + response_body phase).