use thiserror::Error;
pub type Result<T> = std::result::Result<T, ObservabilityError>;
#[derive(Debug, Error)]
pub enum ObservabilityError {
#[error("Failed to initialize telemetry: {0}")]
TelemetryInit(String),
#[error("Invalid telemetry configuration: {0}")]
InvalidConfig(String),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("Failed to export metrics: {0}")]
MetricsExportFailed(String),
#[error("Failed to export traces: {0}")]
TraceExportFailed(String),
#[error("Failed to create span: {0}")]
SpanCreationFailed(String),
#[error("Failed to propagate context: {0}")]
ContextPropagationFailed(String),
#[error("Failed to connect to exporter: {0}")]
ExporterConnectionFailed(String),
#[error("Invalid metric value: {0}")]
InvalidMetricValue(String),
#[error("Failed to route alert: {0}")]
AlertRoutingFailed(String),
#[error("Feature not enabled: {0}")]
ExporterFeatureDisabled(String),
#[error("Alert deduplication error: {0}")]
AlertDeduplicationError(String),
#[error("SLO calculation error: {0}")]
SloCalculationError(String),
#[error("Anomaly detection error: {0}")]
AnomalyDetectionError(String),
#[error("Failed to generate dashboard: {0}")]
DashboardGenerationFailed(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[cfg(feature = "http-exporter")]
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("URL parse error: {0}")]
UrlParse(#[from] url::ParseError),
#[error("Operation timed out")]
Timeout,
#[error("Resource not found: {0}")]
NotFound(String),
#[error("Other error: {0}")]
Other(String),
}