Skip to content

Commit d400be4

Browse files
authored
fix: [Geneva uploader] Set static headers as default reqwest headers for config API (#468)
1 parent ecfdca3 commit d400be4

File tree

1 file changed

+6
-12
lines changed
  • opentelemetry-exporter-geneva/geneva-uploader/src/config_service

1 file changed

+6
-12
lines changed

opentelemetry-exporter-geneva/geneva-uploader/src/config_service/client.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ pub(crate) struct GenevaConfigClient {
201201
precomputed_url_prefix: String,
202202
agent_identity: String,
203203
agent_version: String,
204-
static_headers: HeaderMap,
205204
}
206205

207206
impl fmt::Debug for GenevaConfigClient {
@@ -211,7 +210,6 @@ impl fmt::Debug for GenevaConfigClient {
211210
.field("precomputed_url_prefix", &self.precomputed_url_prefix)
212211
.field("agent_identity", &self.agent_identity)
213212
.field("agent_version", &self.agent_version)
214-
.field("static_headers", &self.static_headers)
215213
.finish()
216214
}
217215
}
@@ -234,9 +232,13 @@ impl GenevaConfigClient {
234232
/// * `GenevaConfigClientError::AuthMethodNotImplemented` - If the specified authentication method is not yet supported
235233
#[allow(dead_code)]
236234
pub(crate) fn new(config: GenevaConfigClientConfig) -> Result<Self> {
235+
let agent_identity = "GenevaUploader";
236+
let agent_version = "0.1";
237+
237238
let mut client_builder = Client::builder()
238239
.http1_only()
239-
.timeout(Duration::from_secs(30)); //TODO - make this configurable
240+
.timeout(Duration::from_secs(30)) //TODO - make this configurable
241+
.default_headers(Self::build_static_headers(agent_identity, agent_version));
240242

241243
match &config.auth_method {
242244
// TODO: Certificate auth would be removed in favor of managed identity.,
@@ -268,10 +270,6 @@ impl GenevaConfigClient {
268270
}
269271
}
270272

271-
let agent_identity = "GenevaUploader";
272-
let agent_version = "0.1";
273-
let static_headers = Self::build_static_headers(agent_identity, agent_version);
274-
275273
let identity = format!("Tenant=Default/Role=GcsClient/RoleInstance={agent_identity}");
276274

277275
let encoded_identity = general_purpose::STANDARD.encode(&identity);
@@ -313,7 +311,6 @@ impl GenevaConfigClient {
313311
precomputed_url_prefix: pre_url,
314312
agent_identity: agent_identity.to_string(), // TODO make this configurable
315313
agent_version: "1.0".to_string(), // TODO make this configurable
316-
static_headers,
317314
})
318315
}
319316

@@ -517,10 +514,7 @@ impl GenevaConfigClient {
517514

518515
let req_id = Uuid::new_v4().to_string();
519516

520-
let mut request = self
521-
.http_client
522-
.get(&url)
523-
.headers(self.static_headers.clone()); // Clone only cheap references
517+
let mut request = self.http_client.get(&url);
524518

525519
request = request.header("x-ms-client-request-id", req_id);
526520

0 commit comments

Comments
 (0)