opentelemetry_configuration/
error.rs

1//! Error types for SDK initialisation and lifecycle.
2
3use figment::Error as FigmentError;
4
5/// Errors from SDK initialisation and lifecycle.
6#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum SdkError {
9    /// Failed to extract configuration from sources.
10    #[error("configuration error: {0}")]
11    Config(#[source] Box<FigmentError>),
12
13    /// Failed to create trace exporter.
14    #[error("failed to create trace exporter")]
15    TraceExporter(#[source] opentelemetry_otlp::ExporterBuildError),
16
17    /// Failed to create metric exporter.
18    #[error("failed to create metric exporter")]
19    MetricExporter(#[source] opentelemetry_otlp::ExporterBuildError),
20
21    /// Failed to create log exporter.
22    #[error("failed to create log exporter")]
23    LogExporter(#[source] opentelemetry_otlp::ExporterBuildError),
24
25    /// Failed to initialise tracing subscriber.
26    #[error("failed to initialise tracing subscriber")]
27    TracingSubscriber(#[from] tracing_subscriber::util::TryInitError),
28
29    /// Failed to flush providers.
30    #[error("failed to flush providers")]
31    Flush(#[source] opentelemetry_sdk::error::OTelSdkError),
32
33    /// Failed to shut down providers.
34    #[error("failed to shut down providers")]
35    Shutdown(#[source] opentelemetry_sdk::error::OTelSdkError),
36
37    /// Invalid endpoint URL format.
38    #[error("invalid endpoint URL: {url} (must start with http:// or https://)")]
39    InvalidEndpoint {
40        /// The invalid URL that was provided.
41        url: String,
42    },
43}