UNPKG

enhanced-adot-node-autoinstrumentation

Version:

This package provides Amazon Web Services distribution of the OpenTelemetry Node Instrumentation, which allows for auto-instrumentation of NodeJS applications.

105 lines 5.3 kB
import { ENVIRONMENT } from '@opentelemetry/core'; import { Instrumentation } from '@opentelemetry/instrumentation'; import { Resource } from '@opentelemetry/resources'; import { PeriodicExportingMetricReader, PushMetricExporter } from '@opentelemetry/sdk-metrics'; import { NodeSDKConfiguration } from '@opentelemetry/sdk-node'; import { Sampler, SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base'; import { LogRecordExporter, LogRecordProcessor } from '@opentelemetry/sdk-logs'; export declare const AWS_LAMBDA_FUNCTION_NAME_CONFIG: string; export declare const AGENT_OBSERVABILITY_ENABLED = "AGENT_OBSERVABILITY_ENABLED"; /** * Aws Application Signals Config Provider creates a configuration object that can be provided to * the OTel NodeJS SDK for Auto Instrumentation with Application Signals Functionality. * * The config includes: * - Use AlwaysRecordSampler (wraps around a specified Sampler) to record all spans. * - Add SpanMetricsProcessor to create metrics. * - Add AttributePropagatingSpanProcessor to propagate span attributes from parent to child spans. * - Add AwsMetricAttributesSpanExporter to add more attributes to all spans. * * You can control when these customizations are applied using the environment variable * OTEL_AWS_APPLICATION_SIGNALS_ENABLED. This flag is disabled by default. */ export declare class AwsOpentelemetryConfigurator { private resource; private instrumentations; private idGenerator; private sampler; private spanProcessors; private logRecordProcessors; private propagator; /** * The constructor will setup the AwsOpentelemetryConfigurator object to be able to provide a * configuration for ADOT JavaScript Auto-Instrumentation. * * The `instrumentations` are the desired Node auto-instrumentations to be used when using ADOT JavaScript. * The auto-Instrumentions are usually populated from OTel's `getNodeAutoInstrumentations()` method from the * `@opentelemetry/auto-instrumentations-node` NPM package, and may have instrumentation patching applied. * * @constructor * @param {Instrumentation[]} instrumentations - Auto-Instrumentations to be added to the ADOT Config */ constructor(instrumentations: Instrumentation[], useXraySampler?: boolean); private customizeVersions; configure(): Partial<NodeSDKConfiguration>; static isApplicationSignalsEnabled(): boolean; static geMetricExportInterval(): number; static customizeSpanProcessors(spanProcessors: SpanProcessor[], resource: Resource): void; static createEmfExporterMetricReader(): PeriodicExportingMetricReader | undefined; static customizeSampler(sampler: Sampler): Sampler; } export declare function customBuildSamplerFromEnv(resource: Resource, useXraySampler?: boolean): Sampler; export declare class ApplicationSignalsExporterProvider { private static _instance; private constructor(); static get Instance(): ApplicationSignalsExporterProvider; createExporter(): PushMetricExporter; private aggregationSelector; } export declare class AwsLoggerProcessorProvider { static getlogRecordProcessors(): LogRecordProcessor[]; static configureLogExportersFromEnv(): LogRecordExporter[]; /** * Retrieves a list of strings from an environment variable. * - Uses ',' as the delimiter. * - Trims leading and trailing whitespace from each entry. * - Excludes empty entries. * - Returns `undefined` if the environment variable is empty or contains only whitespace. * - Returns an empty array if all entries are empty or whitespace. * * @param {string} key - The name of the environment variable to retrieve. * @returns {string[] | undefined} - The list of strings or `undefined`. */ private static getStringListFromEnv; /** * Retrieves a string from an environment variable. * - Returns `undefined` if the environment variable is empty, unset, or contains only whitespace. * * @param {string} key - The name of the environment variable to retrieve. * @returns {string | undefined} - The string value or `undefined`. */ private static getStringFromEnv; } export declare class AwsSpanProcessorProvider { private _configuredExporters; private _spanProcessors; private resource; static configureOtlp(): SpanExporter; static getOtlpProtocol(): string; private static configureJaeger; protected static _registeredExporters: Map<string, () => SpanExporter>; constructor(resource: Resource); private createExportersFromList; protected _getSpanExporter(name: string): SpanExporter | undefined; private configureSpanProcessors; private filterBlanksAndNulls; static customizeSpanExporter(spanExporter: SpanExporter, resource: Resource): SpanExporter; getSpanProcessors(): SpanProcessor[]; } /** * Based on environment, builds a sampler, complies with specification. * @param environment optional, by default uses getEnv(), but allows passing a value to reuse parsed environment */ export declare function buildSamplerFromEnv(environment?: Required<ENVIRONMENT>): Sampler; export declare function isLambdaEnvironment(): boolean; //# sourceMappingURL=aws-opentelemetry-configurator.d.ts.map