fix: correct otlp endpoint formatting (#4646)

This commit is contained in:
Weny Xu
2024-09-02 02:59:50 +00:00
committed by GitHub
parent 37dcf34bb9
commit 2564b5daee
+7 -1
View File
@@ -234,7 +234,13 @@ pub fn init_global_logging(
opentelemetry_otlp::new_exporter().tonic().with_endpoint(
opts.otlp_endpoint
.as_ref()
.map(|e| format!("http://{}", e))
.map(|e| {
if e.starts_with("http") {
e.to_string()
} else {
format!("http://{}", e)
}
})
.unwrap_or(DEFAULT_OTLP_ENDPOINT.to_string()),
),
)