id_effect_opentelemetry
Phase B integration: OpenTelemetry traces, metrics, and logs alongside id_effect's built-in
with_span and
Metric helpers.
See the mdBook chapter "OpenTelemetry (id_effect_opentelemetry)" and
docs/effect-ts-parity/phases/phase-b-opentelemetry.md.
Features
| Feature | Purpose |
|---|---|
otlp (default) |
OTLP gRPC/HTTP exporters via install_from_config |
config |
Load settings from id_effect_config keys (otel.*) |
platform |
W3C inject/extract on id_effect_platform::http::HttpRequest |
Disable defaults for test-only builds:
= { = "../id_effect_opentelemetry", = false }
Production OTLP (one call)
use ;
let guard = install_from_config?;
// ... run your server ...
shutdown_otel_on_signal.await;
Environment variables follow the OpenTelemetry spec:
OTEL_EXPORTER_OTLP_ENDPOINT— collector URL (defaulthttp://localhost:4317)OTEL_EXPORTER_OTLP_PROTOCOL—grpcorhttpOTEL_SERVICE_NAME—service.nameresource attributeOTEL_EXPORTER_OTLP_HEADERS— comma-separatedkey=valuepairsRUST_LOG— optionalEnvFilterwhen installing the global subscriber
Highlights
with_span_otel: composesid_effect::with_spanwith atracingspan exported via OTEL.- W3C propagation: trace context + baggage on portable header maps (and
HttpRequestwithplatform). - Metric bridges: dual-write from
Metriccounters/histograms to OTEL instruments. - Logs bridge:
tracingevents exported to OTEL logs viaopentelemetry-appender-tracing. - Unified starter:
install_otel_starterwires traces, metrics, logs, and propagators. - Test harness:
with_otel_test_harness— in-memory exporters, no global clashes.
Examples
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
Tests