Skip to main content

photon_backend/instrumentation/
labels.rs

1//! Stable label values for Photon self-metrics.
2
3/// Failure reason for [`super::metrics::record_handler_failure`] and DLQ rows.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum FailureReason {
6    /// Identity reconstruction failed before the handler ran.
7    IdentityBuild,
8    /// Handler returned an error.
9    HandlerError,
10    /// Checkpoint commit failed after successful delivery.
11    CheckpointError,
12}
13
14impl FailureReason {
15    /// Stable metric / ops-log label for this reason.
16    #[must_use]
17    pub const fn as_str(self) -> &'static str {
18        match self {
19            Self::IdentityBuild => "identity_build",
20            Self::HandlerError => "handler_error",
21            Self::CheckpointError => "checkpoint_error",
22        }
23    }
24}