Skip to main content

a2a_protocol_server/metrics/
push_outcome.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Tom F. <[email protected]> (https://github.com/tomtom215)
3
4//! Outcome labels passed to [`Metrics::on_push_delivery`](super::Metrics::on_push_delivery).
5//!
6//! In a file of its own since 0.16.0, when `throttled` and `expired` took
7//! `metrics/mod.rs` past 500 lines.
8
9/// The webhook accepted the delivery.
10pub const DELIVERED: &str = "delivered";
11/// The webhook was reached and refused it, or the sender errored.
12///
13/// Also reported, once for the event and not once per config, when the
14/// task's webhook list could not be read (after the retry that a task
15/// write gets, `persistence_operation::PUSH_CONFIG_LIST`), so none of its
16/// webhooks was tried. Until 2026-10-31 that case reported nothing at all
17/// (audit D-04).
18pub const FAILED: &str = "failed";
19/// The delivery did not complete within the configured timeout.
20pub const TIMEOUT: &str = "timeout";
21/// The delivery was cut short by `push_delivery_timeout` while the sender's
22/// own schedule still had attempts left.
23///
24/// Distinct from [`TIMEOUT`], which is a webhook that did not answer inside
25/// the time it was given. This one is a *configuration* result: the sender
26/// reports (via `PushSender::max_delivery_duration`) that it wanted longer
27/// than the handler allows, so retries it advertises can never run in full.
28/// At the shipped defaults that can only be the last attempt — a 38-second
29/// schedule against a 30-second bound, in which every attempt starts and
30/// the third has 2 seconds when the first two run to their timeouts. It
31/// is worth its own label because the fix is a config change, not a
32/// webhook investigation.
33pub const TIMEOUT_TRUNCATED: &str = "timeout_truncated";
34/// A delivery dropped before it started: its task's push lane was full.
35///
36/// The lane (`HandlerLimits::push_queue_capacity`) fills when the webhook
37/// is slower than the agent or not answering. Counted once per dropped
38/// delivery (one event, or one blocking send's batch), not per config.
39/// A terminal or interrupted status is never dropped.
40pub const DROPPED: &str = "dropped";
41/// A delivery not attempted, because its webhook is suspended.
42///
43/// A webhook is suspended after
44/// [`HandlerLimits::push_suspend_after`](crate::handler::HandlerLimits::push_suspend_after)
45/// failed deliveries in a row, for
46/// [`push_suspend_for`](crate::handler::HandlerLimits::push_suspend_for) and
47/// longer after each failed probe. Counted once per skipped delivery, one
48/// per config. A delivery that ends a turn is attempted anyway, and
49/// counted as whatever it came to; a success ends the suspension (audit
50/// D-05).
51pub const SUSPENDED: &str = "suspended";
52/// The webhook answered `410 Gone` and its config was removed.
53///
54/// See [`HandlerLimits::push_remove_gone`](crate::handler::HandlerLimits::push_remove_gone).
55/// Counted for each delivery that learned it; a blocking send's batch
56/// reads its configs once, so its later events are counted too, and the
57/// config takes no delivery after that (audit D-05).
58pub const GONE: &str = "gone";
59/// A delivery not attempted: it waited for a slot in the push gate for
60/// all of `push_delivery_timeout`.
61///
62/// The gate is `HandlerLimits::push_max_in_flight`, `_per_partition` and
63/// `_per_host`. No request was made, so the webhook is not counted as failing
64/// (audit NEW-f-2). Until 0.16.0 the wait counted against the delivery's
65/// timeout and such a delivery was reported as [`TIMEOUT`].
66pub const THROTTLED: &str = "throttled";
67/// A delivery dropped by the push outbox because it was older than
68/// `HandlerLimits::push_outbox_max_age` when it was next due (ADR 0037).
69///
70/// Its webhook did not take it in that time; the event is still in the
71/// task's log, for a receiver to read after the gap.
72pub const EXPIRED: &str = "expired";
73/// The outbox worker settled a push reservation that a replica left behind.
74///
75/// The replica reserved an event's rows and stopped before arming or
76/// releasing them, and the task store said whether the event was stored (ADR
77/// 0037, audit H14). Not a delivery: a count of crashes (or stalls past the
78/// hold) the outbox recovered from, so an alert can tell that replicas are
79/// dying mid-event. A reservation that two replicas settle at once is
80/// counted by each.
81pub const RESERVATION_SETTLED: &str = "reservation_settled";
82/// No longer reported.
83///
84/// It counted configs the per-event delivery budget never reached; since
85/// 2026-10-11 every config is attempted (spec §4.3.3) and the budget sets
86/// concurrency instead, so nothing is skipped. Kept so code matching on
87/// the label still compiles; removing a public constant is a semver break
88/// (see RELEASING.md).
89pub const SKIPPED: &str = "skipped";