Skip to content

Commit 4d22a69

Browse files
committed
Support trace exporter config
1 parent 0fc020e commit 4d22a69

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.changeset/few-candles-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pydantic/logfire-browser": minor
3+
---
4+
5+
Support configuration for the trace exporter config

packages/logfire-browser/src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import * as logfireApi from '@pydantic/logfire-api'
2525
export { DiagLogLevel } from '@opentelemetry/api'
2626
export * from '@pydantic/logfire-api'
2727

28+
type TraceExporterConfig = NonNullable<typeof OTLPTraceExporter extends new (config: infer T) => unknown ? T : never>
29+
2830
export interface LogfireConfigOptions {
2931
/**
3032
* The configuration of the batch span processor.
@@ -64,6 +66,11 @@ export interface LogfireConfigOptions {
6466
*/
6567
serviceVersion?: string
6668

69+
/**
70+
* configures the trace exporter.
71+
*/
72+
traceExporterConfig?: TraceExporterConfig
73+
6774
/**
6875
* The URL of your trace exporter proxy endpoint.
6976
*/
@@ -103,7 +110,12 @@ export function configure(options: LogfireConfigOptions) {
103110
const tracerProvider = new WebTracerProvider({
104111
idGenerator: new ULIDGenerator(),
105112
resource,
106-
spanProcessors: [new BatchSpanProcessor(new OTLPTraceExporter({ url: options.traceUrl }), options.batchSpanProcessorConfig)],
113+
spanProcessors: [
114+
new BatchSpanProcessor(
115+
new OTLPTraceExporter({ ...options.traceExporterConfig, url: options.traceUrl }),
116+
options.batchSpanProcessorConfig
117+
),
118+
],
107119
})
108120

109121
if (options.enableZoneContextManager !== false) {

0 commit comments

Comments
 (0)