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.
This commit is contained in:
Harald Hoyer 2025-02-19 13:58:39 +01:00
parent ee3061b2ec
commit 98a71b3e3a
Signed by: harald
GPG key ID: F519A1143B3FBE32

View file

@ -39,7 +39,12 @@ pub struct HttpSource<F: Format> {
#[async_trait]
impl<F: Format + Send + Sync + Debug> AsyncSource for HttpSource<F> {
async fn collect(&self) -> Result<Map<String, config::Value>, 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(),
}
}