use tracing_subscriber::Layer;
use tracing_subscriber::registry::LookupSpan;
#[derive(Debug, thiserror::Error)]
pub enum OtelCtxEnableError {
#[error("{}", crate::i18n::fl!("otel-not-compiled"))]
NotCompiled,
}
pub enum OtelCtx {}
impl OtelCtx {
pub fn try_enable(_service_name: &'static str) -> Result<Option<Self>, OtelCtxEnableError> {
if atuin_common::env::var_os("ATUIN_OTEL").is_some() {
return Err(OtelCtxEnableError::NotCompiled);
}
Ok(None)
}
#[allow(clippy::unused_self)]
pub fn layer<S>(&self, _service_name: &'static str) -> impl Layer<S> + Send + Sync
where
S: tracing::Subscriber + for<'a> LookupSpan<'a> + Send + Sync,
{
None::<tracing_subscriber::fmt::Layer<S>>
}
}