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#[must_use]
8#[non_exhaustive]
9pub enum SdkError {
10    /// Failed to extract configuration from sources.
11    #[error("configuration error: {0}")]
12    Config(#[source] Box<FigmentError>),
13
14    /// Failed to create trace exporter.
15    #[error("failed to create trace exporter")]
16    TraceExporter(#[source] opentelemetry_otlp::ExporterBuildError),
17
18    /// Failed to create metric exporter.
19    #[error("failed to create metric exporter")]
20    MetricExporter(#[source] opentelemetry_otlp::ExporterBuildError),
21
22    /// Failed to create log exporter.
23    #[error("failed to create log exporter")]
24    LogExporter(#[source] opentelemetry_otlp::ExporterBuildError),
25
26    /// Failed to initialise tracing subscriber.
27    #[error("failed to initialise tracing subscriber")]
28    TracingSubscriber(#[from] tracing_subscriber::util::TryInitError),
29
30    /// Failed to flush providers.
31    #[error("failed to flush providers")]
32    Flush(#[source] opentelemetry_sdk::error::OTelSdkError),
33
34    /// Failed to shut down providers.
35    #[error("failed to shut down providers")]
36    Shutdown(#[source] opentelemetry_sdk::error::OTelSdkError),
37
38    /// Invalid endpoint URL format.
39    #[error("invalid endpoint URL: {url} (must start with http:// or https://)")]
40    InvalidEndpoint {
41        /// The invalid URL that was provided.
42        url: String,
43    },
44}