Skip to content

Commit 32bae4c

Browse files
authored
fix: dont eprintln (#24)
* fix: dont eprintln * fix: line * fix: expand debug
1 parent 785f88c commit 32bae4c

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/utils/otlp.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,6 @@ impl Drop for OtelGuard {
6161
}
6262
}
6363

64-
/// Otlp parse error.
65-
#[derive(Debug, Clone, PartialEq, Eq)]
66-
pub struct OtlpParseError(String);
67-
68-
impl From<String> for OtlpParseError {
69-
fn from(s: String) -> Self {
70-
Self(s)
71-
}
72-
}
73-
74-
impl core::fmt::Display for OtlpParseError {
75-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
76-
f.write_str(&format!("invalid OTLP protocol: {}", self.0))
77-
}
78-
}
79-
80-
impl core::error::Error for OtlpParseError {}
81-
8264
/// Otel configuration. This struct is intended to be loaded from the env vars
8365
///
8466
/// The env vars it checks are:
@@ -139,7 +121,7 @@ impl FromEnv for OtelConfig {
139121

140122
fn from_env() -> Result<Self, FromEnvErr<Self::Error>> {
141123
// load endpoint from env. ignore empty values (shortcut return None), parse, and print the error if any using inspect_err
142-
let endpoint = Url::from_env_var(OTEL_ENDPOINT).inspect_err(|e| eprintln!("{e}"))?;
124+
let endpoint = Url::from_env_var(OTEL_ENDPOINT)?;
143125

144126
let level = tracing::Level::from_env_var(OTEL_LEVEL).unwrap_or(tracing::Level::DEBUG);
145127

src/utils/tracing.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ pub fn init_tracing() -> Option<OtelGuard> {
5656
Some(guard)
5757
} else {
5858
install_fmt!(registry);
59+
tracing::debug!(
60+
"No OTEL config found or error while loading otel config, using default tracing"
61+
);
5962
None
6063
}
6164
}

0 commit comments

Comments
 (0)