Skip to main content

oxigdal_observability/
error.rs

1//! Error types for observability operations.
2
3use thiserror::Error;
4
5/// Result type for observability operations.
6pub type Result<T> = std::result::Result<T, ObservabilityError>;
7
8/// Errors that can occur during observability operations.
9#[derive(Debug, Error)]
10pub enum ObservabilityError {
11    /// Telemetry initialization failed.
12    #[error("Failed to initialize telemetry: {0}")]
13    TelemetryInit(String),
14
15    /// Telemetry configuration error.
16    #[error("Invalid telemetry configuration: {0}")]
17    InvalidConfig(String),
18
19    /// Configuration error.
20    #[error("Configuration error: {0}")]
21    ConfigError(String),
22
23    /// Metrics export failed.
24    #[error("Failed to export metrics: {0}")]
25    MetricsExportFailed(String),
26
27    /// Trace export failed.
28    #[error("Failed to export traces: {0}")]
29    TraceExportFailed(String),
30
31    /// Failed to create span.
32    #[error("Failed to create span: {0}")]
33    SpanCreationFailed(String),
34
35    /// Context propagation error.
36    #[error("Failed to propagate context: {0}")]
37    ContextPropagationFailed(String),
38
39    /// Exporter connection failed.
40    #[error("Failed to connect to exporter: {0}")]
41    ExporterConnectionFailed(String),
42
43    /// Invalid metric value.
44    #[error("Invalid metric value: {0}")]
45    InvalidMetricValue(String),
46
47    /// Alert routing failed.
48    #[error("Failed to route alert: {0}")]
49    AlertRoutingFailed(String),
50
51    /// Alert deduplication error.
52    #[error("Alert deduplication error: {0}")]
53    AlertDeduplicationError(String),
54
55    /// SLO calculation error.
56    #[error("SLO calculation error: {0}")]
57    SloCalculationError(String),
58
59    /// Anomaly detection error.
60    #[error("Anomaly detection error: {0}")]
61    AnomalyDetectionError(String),
62
63    /// Dashboard generation error.
64    #[error("Failed to generate dashboard: {0}")]
65    DashboardGenerationFailed(String),
66
67    /// IO error.
68    #[error("IO error: {0}")]
69    Io(#[from] std::io::Error),
70
71    /// Serialization error.
72    #[error("Serialization error: {0}")]
73    Serialization(#[from] serde_json::Error),
74
75    /// HTTP client error.
76    #[error("HTTP error: {0}")]
77    Http(#[from] reqwest::Error),
78
79    /// URL parse error.
80    #[error("URL parse error: {0}")]
81    UrlParse(#[from] url::ParseError),
82
83    /// Operation timeout.
84    #[error("Operation timed out")]
85    Timeout,
86
87    /// Resource not found.
88    #[error("Resource not found: {0}")]
89    NotFound(String),
90
91    /// Other error.
92    #[error("Other error: {0}")]
93    Other(String),
94}