Node.js Auto-Instrumentation Registrar (src/register.ts)

opentelemetry-js-contrib · packages/auto-instrumentations-node/src/register.ts · typescript · Apache-2.0
analytics, infra, lang:typescript, fw:node

Registers OpenTelemetry auto-instrumentations for Node.js applications. Use this to automatically collect observability data without modifying core application code.

// Source: https://github.com/open-telemetry/opentelemetry-js-contrib | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import * as opentelemetry from '@opentelemetry/sdk-node';
import { diag, DiagConsoleLogger } from '@opentelemetry/api';
import { getStringFromEnv, diagLogLevelFromString } from '@opentelemetry/core';
import {
  getNodeAutoInstrumentations,
  getResourceDetectorsFromEnv,
} from './utils';

const logLevel = getStringFromEnv('OTEL_LOG_LEVEL');
if (logLevel != null) {
  diag.setLogger(new DiagConsoleLogger(), {
    logLevel: diagLogLevelFromString(logLevel),
  });
}

const instrumentat

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key