feat(server): OTLP trace export — ORCH8_OTLP_ENDPOINT with orch8.step spans#66
Merged
Conversation
… spans Adds optional OpenTelemetry trace export to orch8-server, enabled only when ORCH8_OTLP_ENDPOINT (config: [telemetry] otlp_endpoint) is set: - New [telemetry] config section (otlp_endpoint, otlp_protocol) with env overrides ORCH8_OTLP_ENDPOINT / ORCH8_OTLP_PROTOCOL (grpc only) and startup validation. Unset endpoint = zero behavior change. - orch8-server gains a default-on `otlp` cargo feature wiring tracing-opentelemetry onto the existing subscriber (fmt + env-filter preserved), with a self-feedback filter so exporter errors can't loop back into the exporter. Tracer provider is flushed on graceful shutdown after the engine drains. - OTel 0.29 line pinned (opentelemetry/opentelemetry_sdk/-otlp 0.29, tracing-opentelemetry 0.30): newest releases whose grpc-tonic transport links against the workspace's tonic 0.12 (0.30+ needs 0.13). - Engine emits an `orch8.step` span around every step-handler invocation (flat + tree paths) with instance_id, block_id, handler, tenant_id, attempt — the existing gen_ai.client.inference event from llm_call rides inside it. Identity fields only; no params/outputs. - Tests: config parsing (set/unset/protocol validation), env override round-trip, subscriber smoke test against a non-listening endpoint (init + flush must be non-fatal), and a tracing-layer test asserting the orch8.step span wraps a mock handler with the expected fields. - Docs: .env.example + docs/CONFIGURATION.md telemetry sections. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts: # Cargo.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The remaining half of FEATURE_OPPORTUNITIES item #10. OTLP trace export, enabled only when
ORCH8_OTLP_ENDPOINT(or[telemetry] otlp_endpoint) is set — zero behavior change when unset.tracing-opentelemetry0.30. Default-onotlpcargo feature with a no-op mirror for--no-default-features.service.name=orch8-serveryielding toOTEL_SERVICE_NAME, version,OTEL_RESOURCE_ATTRIBUTEShonored), per-layer filter droppingopentelemetry/tonic/h2/hypertargets so exporter errors can't feed back into the exporter, and graceful flush after drain on shutdown.orch8.stepinfo-span around handler invocation on BOTH dispatch paths (flat scheduler + tree evaluator):instance_id,block_id,handler,tenant_id,attempt— identity only, no params/outputs. The existinggen_ai.client.inferenceevent rides inside it..env.example+docs/CONFIGURATION.mdupdated.Tests
9 new (config parsing, env overrides, inert-when-unset init, protocol rejection, smoke test against a non-listening endpoint — init/emit/flush all non-fatal, span emission). Suites: orch8-types+server 446 passed, orch8-engine 2086 passed. fmt/clippy (incl. --no-default-features)/doc/deny gates clean.
🤖 Generated with Claude Code