File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/traceloop-sdk/src/lib Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ export interface InitializeOptions {
6464 */
6565 exporter ?: SpanExporter ;
6666
67+ /**
68+ * The headers to be sent with the traces data. Optional.
69+ */
70+ headers ?: Record < string , string > ;
71+
6772 /**
6873 * The OpenTelemetry SpanProcessor to be used for processing traces data. Optional.
6974 * Defaults to the BatchSpanProcessor.
Original file line number Diff line number Diff line change @@ -261,9 +261,11 @@ export const startTracing = (options: InitializeOptions) => {
261261 } ) ;
262262 }
263263
264- const headers = process . env . TRACELOOP_HEADERS
265- ? baggageUtils . parseKeyPairsIntoRecord ( process . env . TRACELOOP_HEADERS )
266- : { Authorization : `Bearer ${ options . apiKey } ` } ;
264+ const headers =
265+ options . headers ||
266+ ( process . env . TRACELOOP_HEADERS
267+ ? baggageUtils . parseKeyPairsIntoRecord ( process . env . TRACELOOP_HEADERS )
268+ : { Authorization : `Bearer ${ options . apiKey } ` } ) ;
267269
268270 const traceExporter =
269271 options . exporter ??
You can’t perform that action at this time.
0 commit comments