nav.groups.config

Observability

Tracing and optional OpenTelemetry integration for the runtime.

Observability

Tracing and OpenTelemetry.

behest uses the tracing crate for structured, span-based observability. Every major operation — model calls, tool executions, compaction runs, state transitions — is wrapped in a tracing span with structured fields.

Spans

The runtime emits spans for:

OperationSpan nameKey fields
Runrunrun_id, session_id, provider
Turnturnrun_id, iteration
Model callmodel.callprovider, model, input_tokens
Tool executiontool.executetool_name, call_id, duration_ms
Compactioncompactionsession_id, original_tokens, summary_tokens
Snapshot savesnapshot.saverun_id, seq

Events

Key events are logged at INFO or WARN level:

tracing::info!(%run_id, %provider, %model, "run started");
tracing::warn!(%run_id, error = %e, "tool execution failed");
tracing::error!(%session_id, failures = %n, "compaction circuit opened");

OpenTelemetry

Feature otel enables the tracing-opentelemetry layer:

[dependencies]
behest = { version = "0.4", features = ["otel"] }

The OpenTelemetry layer exports spans and events to an OTLP collector. Configure via standard OTEL_* environment variables:

export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_SERVICE_NAME="behest"

Subscriber setup

The runtime does not set up the tracing subscriber. The caller is responsible for installing a subscriber before constructing the runtime:

use tracing_subscriber::fmt;

tracing_subscriber::fmt()
    .with_env_filter("behest=info")
    .init();

let runtime = config.build_runtime().await?;

See also

Related components

Edit this page on GitHub →