File tree 1 file changed +6
-1
lines changed
packages/traceloop-sdk/src/lib/tracing
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 5
5
BatchSpanProcessor ,
6
6
SpanProcessor ,
7
7
} from "@opentelemetry/sdk-trace-node" ;
8
+ import { baggageUtils } from "@opentelemetry/core" ;
8
9
import { Span , context , diag } from "@opentelemetry/api" ;
9
10
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto" ;
10
11
import { Resource } from "@opentelemetry/resources" ;
@@ -246,11 +247,15 @@ export const startTracing = (options: InitializeOptions) => {
246
247
} ) ;
247
248
}
248
249
250
+ const headers = process . env . TRACELOOP_HEADERS
251
+ ? baggageUtils . parseKeyPairsIntoRecord ( process . env . TRACELOOP_HEADERS )
252
+ : { Authorization : `Bearer ${ options . apiKey } ` } ;
253
+
249
254
const traceExporter =
250
255
options . exporter ??
251
256
new OTLPTraceExporter ( {
252
257
url : `${ options . baseUrl } /v1/traces` ,
253
- headers : { Authorization : `Bearer ${ options . apiKey } ` } ,
258
+ headers,
254
259
} ) ;
255
260
_spanProcessor = options . disableBatch
256
261
? new SimpleSpanProcessor ( traceExporter )
You can’t perform that action at this time.
0 commit comments