Expand description
§rusty-otel
OpenTelemetry export layer for the rusty_agent_runtime engine.
rusty-agent-runtime already emits structured tracing spans from its
executor (rusty.run → rusty.super_step → rusty.node). This crate
wires a global tracing_subscriber that routes those spans to
two sinks:
- a human-readable
fmtlayer on stderr (always on), gated by anEnvFilter, and - an OTLP/HTTP span exporter (only when
OTelConfig::otlp_endpointis set), so the same spans show up in a collector / Jaeger / any OTLP-compatible backend.
§Quick start
// Local development: pretty logs only.
let _guard = rusty_otel::init_local("my-agent").unwrap();
// With a collector: logs + OTLP spans.
let _guard = rusty_otel::init(rusty_otel::OTelConfig {
service_name: "my-agent".into(),
otlp_endpoint: Some("http://localhost:4318/v1/traces".into()),
log_filter: None, // RUST_LOG, defaulting to a sensible rusty filter
})
.unwrap();Keep the returned OTelGuard alive for the duration of the process and
call OTelGuard::shutdown before exit to flush any buffered spans.
Structs§
- OTel
Config - Configuration for
init. - OTel
Guard - Handle returned by
init/init_local. Shuts down the tracer provider (flushing any buffered spans) onOTelGuard::shutdownor on drop. Shutdown is idempotent.
Enums§
- OTel
Error - Errors returned by
initandinit_local.
Constants§
- DEFAULT_
FILTER - Default log filter used when neither
OTelConfig::log_filternor theRUST_LOGenvironment variable provides one.rusty.super_stepspans are emitted at DEBUG, so therusty_agent_runtime=debugdirective surfaces the full span taxonomy locally without drowning other crates in noise.
Functions§
- init
- Install the global tracing subscriber.
- init_
local - Install the global tracing subscriber with a local-only configuration:
fmtlayer +EnvFilter, no OTLP export. Equivalent to callinginitwith only a service name.
Type Aliases§
- Result
- Convenient result alias for this crate.