From 7939a56c5fd9850bfeb1083a389b266414e0f387 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Mon, 4 Nov 2024 11:20:58 +0000 Subject: [PATCH] fix: default url for telemetry should include protocol closes: https://github.com/influxdata/influxdb/issues/25502 --- influxdb3/src/commands/serve.rs | 2 +- influxdb3_telemetry/src/sender.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/influxdb3/src/commands/serve.rs b/influxdb3/src/commands/serve.rs index e49c7b93aa5..7c119018a27 100644 --- a/influxdb3/src/commands/serve.rs +++ b/influxdb3/src/commands/serve.rs @@ -267,7 +267,7 @@ pub struct Config { #[clap( long = "telemetry-endpoint", env = "INFLUXDB3_TELEMETRY_ENDPOINT", - default_value = "localhost", + default_value = "http://127.0.0.1:9999", action )] pub telemetry_endpoint: String, diff --git a/influxdb3_telemetry/src/sender.rs b/influxdb3_telemetry/src/sender.rs index 3f3479e9804..5d13a02bbcc 100644 --- a/influxdb3_telemetry/src/sender.rs +++ b/influxdb3_telemetry/src/sender.rs @@ -132,6 +132,19 @@ mod tests { mock.assert_async().await; } + #[test_log::test(test)] + #[should_panic] + fn test_sender_creation_with_invalid_url_panics() { + let client = reqwest::Client::new(); + let _ = TelemetrySender::new(client, "localhost"); + } + + #[test_log::test(test)] + fn test_sender_creation_with_valid_url_succeeds() { + let client = reqwest::Client::new(); + let _ = TelemetrySender::new(client, "http://localhost"); + } + #[test] fn test_url_join() { let url = Url::parse("https://foo.com/boo/1.html").unwrap();