Skip to content

Commit

Permalink
feat: opt-in for fs instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed May 14, 2024
1 parent 1d5bcb9 commit 7f161cb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ if (process.env.DASH0_OTEL_COLLECTOR_BASE_URL) {
baseUrl = process.env.DASH0_OTEL_COLLECTOR_BASE_URL;
}

const instrumentationConfig: any = {};
if (
!process.env.DASH0_ENABLE_FS_INSTRUMENTATION ||
process.env.DASH0_ENABLE_FS_INSTRUMENTATION.trim().toLowerCase() !== 'true'
) {
instrumentationConfig['@opentelemetry/instrumentation-fs'] = {
enabled: false,
};
}

const configuration: Partial<NodeSDKConfiguration> = {
traceExporter: new OTLPTraceExporter({
url: `${baseUrl}/v1/traces`,
Expand All @@ -32,16 +42,7 @@ const configuration: Partial<NodeSDKConfiguration> = {
}),
}),

instrumentations: [
getNodeAutoInstrumentations(
// TODO provide an opt-in switch for fs
{
'@opentelemetry/instrumentation-fs': {
enabled: false,
},
},
),
],
instrumentations: [getNodeAutoInstrumentations(instrumentationConfig)],

resource: new Resource({
'telemetry.distro.name': 'dash0-nodejs',
Expand Down

0 comments on commit 7f161cb

Please sign in to comment.