MCP Server Framework - v1.0.0
    Preparing search index...

    Function initializeTelemetry

    • Initialize the OpenTelemetry SDK. Call this at application startup, before any other code.

      All @opentelemetry/* packages are loaded dynamically on first call (see DD-020). When OTEL is disabled, no packages are loaded and the function returns immediately — saving ~15-20 MB of memory.

      Builds both trace and metric exporters from the unified config. Only HTTP and Express instrumentations are loaded — other auto-instrumentations are irrelevant for MCP servers.

      Parameters

      • OptionalonBeforeInit: () => void

        Optional callback invoked before SDK construction. Power users can call diag.setLogger() in this callback to override the framework's default DiagLogger. The callback runs AFTER the framework sets frameworkDiagLogger as default.

      Returns Promise<boolean>

      true if OpenTelemetry was initialized, false if disabled

      import { initializeTelemetry } from './telemetry/index.js';

      const enabled = await initializeTelemetry();