Skip to main content

Crate agent_effects_otel

Crate agent_effects_otel 

Source
Expand description

OpenTelemetry metrics for agent-effects.

use agent_effects::Runtime;
use agent_effects_memory::MemoryStore;
use agent_effects_otel::OtelObserver;

// Uses the global meter provider; set it up with your exporter (OTLP,
// Prometheus, …) as usual.
let runtime = Runtime::builder(MemoryStore::new())
    .observer(OtelObserver::global())
    .build();

Instruments, each with attributes effect.name and effect.kind unless the table says otherwise:

InstrumentKindCounts / measures
agent_effects.startedcountereffects recorded
agent_effects.completedcountereffects committed
agent_effects.failedcountereffects that definitely did not apply
agent_effects.rejectedcountereffects refused by a precondition or approver
agent_effects.unknowncounteroutcomes that became unknown: watch this one. A spike means remote systems are answering ambiguously
agent_effects.needs_interventioncountereffects escalated to an operator
agent_effects.awaiting_interventionup/down countereffects waiting for an operator: escalated or failed compensations (deltas since start)
agent_effects.attemptscounter, attempt = first | retryattempts started
agent_effects.retry.countcounterretries scheduled
agent_effects.retry.delayhistogram, stime from scheduling a retry until it may start
agent_effects.verification.startedcounterverifications started
agent_effects.verification.outcomescounter, outcome = confirmed | not_applied | conflict | inconclusivehow verifications ended
agent_effects.compensation.started / .completed / .failedcountercompensations
agent_effects.pending_approvalup/down countereffects awaiting approval (deltas since start)
agent_effects.approval.decisionscounter, decision = approved | deniedapproval decisions
agent_effects.approval.durationhistogram, s, decisionapproval requested → decided
agent_effects.operator.resolutionscounter, resolution = applied | not_applied | retry | compensatedoperator decisions on unresolved effects
agent_effects.lease.expiredcounterattempts whose worker lost its lease mid-flight
agent_effects.lease.conflictscounter, effect.name onlya worker found another holding an effect
agent_effects.lease.renewal_failurescounter, no attributeslease renewals that failed with a store error
agent_effects.durationhistogram, srecorded → committed, failed or rejected
agent_effects.attempt.durationhistogram, sone attempt, also tagged outcome (the status it ended in)
agent_effects.unknown.durationhistogram, stime spent unknown before being resolved
agent_effects.recovery.passescounter, result = completed | stopped | failedrecovery passes
agent_effects.recovery.durationhistogram, s, resultone recovery pass
agent_effects.recovery.effectscounter, outcome = resumed | marked_unknown | skipped | unhandled | resume_errorwhat passes did, per effect
agent_effects.recovery.backloggauge, state = due | not_due | awaiting_operatorwhat this worker’s latest pass found waiting
agent_effects.prunedcounter, statussettled records deleted by retention

Recovery and pruning instruments carry no effect attributes.

No attribute carries an effect id, a logical key, an input, an output, an actor or an error message: they are unbounded and may identify customers. Every attribute value comes from a small fixed set, apart from effect.name, which the application chooses. Traces need no extra crate: the runtime’s tracing spans (agent_effect.execute, agent_effect.compensate) export through tracing-opentelemetry like any other.

Structs§

OtelObserver
An EffectObserver that records OpenTelemetry metrics.