diff --git a/src/observability/lib/tracing.ts b/src/observability/lib/tracing.ts index 715bf835deb8..1e782f262be0 100644 --- a/src/observability/lib/tracing.ts +++ b/src/observability/lib/tracing.ts @@ -26,12 +26,14 @@ import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express' import { HttpInstrumentation } from '@opentelemetry/instrumentation-http' import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici' import { NodeSDK } from '@opentelemetry/sdk-node' +import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api' -// For tracing diagnostics, uncomment these lines: -// import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api' -// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG) - +// TEMPORARY: enable OTel diagnostic logging to investigate why traces aren't +// arriving in the collector. See github/docs-engineering#6046. Revert once +// the export pipeline is confirmed working. if (process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) { + diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO) + const sdk = new NodeSDK({ serviceName: process.env.OTEL_SERVICE_NAME || 'docs-internal', traceExporter: new OTLPTraceExporter({}),