Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to dynamic header on legacy config #5221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
export interface OTLPExporterConfigBase {
headers?: Record<string, string>;
headers?: Record<string, string> | (() => Record<string, string>);
url?: string;
concurrencyLimit?: number;
/** Maximum time the OTLP exporter will wait for each batch export.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@
}

export function wrapStaticHeadersInFunction(
headers: Record<string, string> | undefined
headers: Record<string, string> | (() => Record<string, string>) | undefined
): (() => Record<string, string>) | undefined {
if (headers == null) {
return undefined;
}

if (headers instanceof Function) {
return headers;

Check warning on line 52 in experimental/packages/otlp-exporter-base/src/configuration/shared-configuration.ts

View check run for this annotation

Codecov / codecov/patch

experimental/packages/otlp-exporter-base/src/configuration/shared-configuration.ts#L52

Added line #L52 was not covered by tests
}

return () => headers;
}

Expand Down
Loading