@azure/monitor-opentelemetry
Version:
Azure Monitor OpenTelemetry (Node.js)
50 lines • 2.09 kB
TypeScript
import type { Sampler } from "@opentelemetry/sdk-trace-base";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import type { InternalConfig } from "../shared/config.js";
import type { MetricHandler } from "../metrics/handler.js";
import { AzureMonitorSpanProcessor } from "./spanProcessor.js";
import type { Instrumentation } from "@opentelemetry/instrumentation";
/**
* Azure Monitor OpenTelemetry Trace Handler
*/
export declare class TraceHandler {
private _batchSpanProcessor;
private _azureSpanProcessor;
private _azureExporter;
private _instrumentations;
private _config;
private _metricHandler;
private _azureFunctionsHook;
private _sampler;
/**
* Initializes a new instance of the TraceHandler class.
* @param _config - Configuration.
* @param _metricHandler - MetricHandler.
*/
constructor(config: InternalConfig, metricHandler: MetricHandler);
getSampler(): Sampler;
getBatchSpanProcessor(): BatchSpanProcessor;
getAzureMonitorSpanProcessor(): AzureMonitorSpanProcessor;
getInstrumentations(): Instrumentation[];
/**
* Shutdown handler
*/
shutdown(): Promise<void>;
/**
* Start auto collection of telemetry
*/
private _initializeInstrumentations;
/**
* Wire the Azure SDK instrumenter into `@azure/core-tracing` directly.
*
* The Azure SDK instrumentation registers its instrumenter through an OpenTelemetry
* module-patch hook that only fires via `require`/`import`-in-the-middle. In ESM hosts
* where the OpenTelemetry loader cannot be registered up front (for example, Azure
* Functions, which controls the Node.js start command), that hook never runs, so Azure
* SDK dependency spans are missing. Because `@azure/core-tracing` resolves its
* instrumenter lazily at span-creation time from shared module-local state, applying
* the same patch directly here enables Azure SDK tracing regardless of module system.
*/
private _wireAzureSdkInstrumenter;
}
//# sourceMappingURL=handler.d.ts.map