Skip to content

Commit 1745c1c

Browse files
committed
🚧 use a set of environment variables to define the OTEL endpoint
1 parent abdc231 commit 1745c1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tools/otlp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ where
1414
use opentelemetry_otlp::WithExportConfig;
1515

1616
global::set_text_map_propagator(TraceContextPropagator::new());
17-
// FIXME choice the right/official env variable `OTEL_COLLECTOR_URL` or `OTEL_EXPORTER_OTLP_ENDPOINT`
1817
// TODO try to autodetect if http or grpc should be used (eg based on env variable, port ???)
1918
//endpoint (default = 0.0.0.0:4317 for grpc protocol, 0.0.0.0:4318 http protocol):
2019
//.http().with_endpoint(collector_url),
2120
let endpoint_grpc = std::env::var("OTEL_EXPORTER_OTLP_ENDPOINT")
22-
.unwrap_or_else(|_| "http://0.0.0.0:4317".to_string());
21+
.or_else(|_| std::env::var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"))
22+
.unwrap_or_else(|_| "http://127.0.0.1:4317".to_string());
2323
let exporter = opentelemetry_otlp::new_exporter()
2424
.tonic()
2525
.with_endpoint(endpoint_grpc);

0 commit comments

Comments
 (0)