mirror of
https://github.com/matter-labs/teepot.git
synced 2025-07-21 23:23:57 +02:00
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:
parent
ee3061b2ec
commit
98a71b3e3a
1 changed files with 7 additions and 2 deletions
|
@ -39,7 +39,12 @@ pub struct HttpSource<F: Format> {
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<F: Format + Send + Sync + Debug> AsyncSource for HttpSource<F> {
|
impl<F: Format + Send + Sync + Debug> AsyncSource for HttpSource<F> {
|
||||||
async fn collect(&self) -> Result<Map<String, config::Value>, ConfigError> {
|
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
|
.await
|
||||||
.map_err(|e| ConfigError::Foreign(Box::new(e)))
|
.map_err(|e| ConfigError::Foreign(Box::new(e)))
|
||||||
{
|
{
|
||||||
|
@ -142,7 +147,7 @@ impl Default for TelemetryOtlpConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
enable: true,
|
enable: true,
|
||||||
endpoint: "127.0.0.1:4317".to_string(),
|
endpoint: "http://127.0.0.1:4317".to_string(),
|
||||||
protocol: "grpc".to_string(),
|
protocol: "grpc".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue