From 98a71b3e3ad2eb6da4cc4e0b366b6ba3e3baf17e Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 19 Feb 2025 13:58:39 +0100 Subject: [PATCH] fix(teepot): add custom HTTP header for google metadata and update default endpoint - Replace `reqwest::get` with a configured `reqwest::Client` to support custom headers (e.g., "Metadata-Flavor: Google"). - Update default OTLP endpoint to include the "http://" prefix for clarity. --- crates/teepot/src/config/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/teepot/src/config/mod.rs b/crates/teepot/src/config/mod.rs index 5cf24a0..dea99ce 100644 --- a/crates/teepot/src/config/mod.rs +++ b/crates/teepot/src/config/mod.rs @@ -39,7 +39,12 @@ pub struct HttpSource { #[async_trait] impl AsyncSource for HttpSource { async fn collect(&self) -> Result, ConfigError> { - let response = match reqwest::get(&self.uri) + let response = match reqwest::Client::builder() + .build() + .map_err(|e| ConfigError::Foreign(Box::new(e)))? + .get(&self.uri) + .header("Metadata-Flavor", "Google") + .send() .await .map_err(|e| ConfigError::Foreign(Box::new(e))) { @@ -142,7 +147,7 @@ impl Default for TelemetryOtlpConfig { fn default() -> Self { Self { enable: true, - endpoint: "127.0.0.1:4317".to_string(), + endpoint: "http://127.0.0.1:4317".to_string(), protocol: "grpc".to_string(), } }