Skip to content

Commit 5e54d9c

Browse files
committed
Option to disable scrubbing in Cloudflare
Fixes #53
1 parent 80e8b77 commit 5e54d9c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.changeset/slick-deer-drop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pydantic/logfire-cf-workers": minor
3+
---
4+
5+
Allow disabling scrubbing

packages/logfire-cf-workers/src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base'
22

33
import { resolveBaseUrl, serializeAttributes, ULIDGenerator } from '@pydantic/logfire-api'
4+
import * as logfireApi from '@pydantic/logfire-api'
45
import { instrument as baseInstrument, TraceConfig } from '@pydantic/otel-cf-workers'
56

67
import { TailWorkerExporter } from './TailWorkerExporter'
78
export * from './exportTailEventsToLogfire'
89

9-
export interface CloudflareConfigOptions {
10-
baseUrl?: string
11-
token: string
12-
}
13-
1410
type Env = Record<string, string | undefined>
1511

1612
type ConfigOptionsBase = Pick<
@@ -20,6 +16,10 @@ type ConfigOptionsBase = Pick<
2016

2117
export interface InProcessConfigOptions extends ConfigOptionsBase {
2218
baseUrl?: string
19+
/**
20+
* Options for scrubbing sensitive data. Set to False to disable.
21+
*/
22+
scrubbing?: false | logfireApi.ScrubbingOptions
2323
}
2424

2525
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
@@ -55,6 +55,9 @@ export function getTailConfig(config: TailConfigOptions): (env: Env) => TraceCon
5555
}
5656

5757
export function instrumentInProcess<T>(handler: T, config: InProcessConfigOptions): T {
58+
if (config.scrubbing !== undefined) {
59+
logfireApi.configureLogfireApi({ scrubbing: config.scrubbing })
60+
}
5861
return baseInstrument(handler, getInProcessConfig(config)) as T
5962
}
6063

0 commit comments

Comments
 (0)