Skip to content

Commit ee2aa2b

Browse files
heiskrCopilot
andauthored
🔧 Fix OTel traces endpoint and disable unused exporters (#61053)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 57851b5 commit ee2aa2b

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎config/moda/configuration/default/env.yaml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ data:
99
RATE_LIMIT_MAX: '21'
1010
# Moda uses a non-default port for sending datadog metrics
1111
DD_DOGSTATSD_PORT: '28125'
12-
# OTel distributed tracing — sends spans to OTel Collector via OTLP/HTTP (proto).
13-
# Uses stamp address (not mesh) since docs-internal is not on the service mesh.
14-
# See https://thehub.github.com/epd/engineering/dev-practicals/observability/distributed-tracing/instrumentation/
15-
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: 'https://otelcol.service.%stamp%.github.net/v1/traces'
12+
# NodeSDK auto-enables OTLP metrics and logs exporters when these env vars
13+
# are unset. We only want traces, so explicitly disable the others to avoid
14+
# spamming export errors. See https://opentelemetry.io/docs/specs/otel/protocol/exporter/
15+
OTEL_METRICS_EXPORTER: 'none'
16+
OTEL_LOGS_EXPORTER: 'none'
17+
# OTel traces endpoint is set per-environment (see production/env.yaml).
18+
# Stagings don't have OTEL_EXPORTER_OTLP_TRACES_HEADERS, so they don't
19+
# export traces — tracing.ts gates SDK startup on the endpoint env var.

‎config/moda/configuration/production/env.yaml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ data:
1313
# Equivalent to HEAVEN_DEPLOYED_ENV === 'production'
1414
MODA_PROD_SERVICE_ENV: 'true'
1515
# OTel distributed tracing — sends spans to OTel Collector via OTLP/HTTP (proto).
16-
# Uses stamp address (not mesh) since docs-internal is not on the service mesh.
16+
# Uses %site% template (not %stamp%) since docs-internal is not on the service
17+
# mesh and not on a Proxima stamp (region: iad, profile: general). %site%
18+
# interpolates to the cluster's site (e.g. iad), giving a hostname like
19+
# otelcol.service.iad.github.net that resolves from production pods.
1720
# See https://thehub.github.com/epd/engineering/dev-practicals/observability/distributed-tracing/instrumentation/
18-
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: 'https://otelcol.service.%stamp%.github.net/v1/traces'
21+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: 'https://otelcol.service.%site%.github.net/v1/traces'

‎src/observability/lib/tracing.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,8 @@ import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'
2626
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'
2727
import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici'
2828
import { NodeSDK } from '@opentelemetry/sdk-node'
29-
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'
3029

31-
// TEMPORARY: enable OTel diagnostic logging to investigate why traces aren't
32-
// arriving in the collector. See github/docs-engineering#6046. Revert once
33-
// the export pipeline is confirmed working.
3430
if (process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) {
35-
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO)
36-
3731
const sdk = new NodeSDK({
3832
serviceName: process.env.OTEL_SERVICE_NAME || 'docs-internal',
3933
traceExporter: new OTLPTraceExporter({}),

0 commit comments

Comments
 (0)