UNPKG

@aws/aws-distro-opentelemetry-node-autoinstrumentation

Version:

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

76 lines 3.81 kB
import { ENVIRONMENT } from '@opentelemetry/core'; import { Instrumentation } from '@opentelemetry/instrumentation'; import { Resource } from '@opentelemetry/resources'; import { PushMetricExporter } from '@opentelemetry/sdk-metrics'; import { NodeSDKConfiguration } from '@opentelemetry/sdk-node'; import { Sampler, SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base'; export declare const AWS_LAMBDA_FUNCTION_NAME_CONFIG: string; /** * 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 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 customizeSpanProcessors(spanProcessors: SpanProcessor[], resource: Resource): void; 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 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