Skip to content

Set otel exporter headers value during runtime. #5129

@huliang-microsoft

Description

@huliang-microsoft

Problem Statement

Sorry if this is not a feasible question.
I am trying to use otel exporter lib to export otel data to an otel collector. And I need to set auth header. This is what I do:

	kv := make(map[string]string)
	kv["Authorization"] = "Bearer " + token

	exporter := otlpmetrichttp.New(ctx, otlpmetrichttp.WithHeaders(kv))

The problem is that I cannot find an API to update the header once the exporter is initialized but when the token is expired, seems the only way is to create another exporter instance.

Is there a way to update the header in the exporter? or if there is not, is it Okay to add an API to update that?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions