Skip to content

Commit

Permalink
fix: add optional env var to disable otel sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mcstover committed Dec 20, 2023
1 parent cdf1bf5 commit 0e70ec0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/instrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-pro
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');

const otlpEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT || null;
const otlpDisabled = process.env?.OTEL_SDK_DISABLED || false;
const otlpEndpoint = process.env?.OTEL_EXPORTER_OTLP_ENDPOINT || null;

if (otlpEndpoint) {
if (!otlpDisabled) {
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter({
url: otlpEndpoint,
Expand Down

0 comments on commit 0e70ec0

Please sign in to comment.