File tree 2 files changed +10
-3
lines changed
packages/traceloop-sdk/src/lib
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ export interface InitializeOptions {
64
64
*/
65
65
exporter ?: SpanExporter ;
66
66
67
+ /**
68
+ * The headers to be sent with the traces data. Optional.
69
+ */
70
+ headers ?: Record < string , string > ;
71
+
67
72
/**
68
73
* The OpenTelemetry SpanProcessor to be used for processing traces data. Optional.
69
74
* Defaults to the BatchSpanProcessor.
Original file line number Diff line number Diff line change @@ -261,9 +261,11 @@ export const startTracing = (options: InitializeOptions) => {
261
261
} ) ;
262
262
}
263
263
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 } ` } ) ;
267
269
268
270
const traceExporter =
269
271
options . exporter ??
You can’t perform that action at this time.
0 commit comments