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.

47 lines 2.42 kB
import { Context, Histogram } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-base'; import { MetricAttributeGenerator } from './metric-attribute-generator'; import { ForceFlushFunction } from './aws-span-processing-util'; /** * This processor will generate metrics based on span data. It depends on a * {@link MetricAttributeGenerator} being provided on instantiation, which will provide a means to * determine attributes which should be used to create metrics. A {@link Resource} must also be * provided, which is used to generate metrics. Finally, three {@link Histogram}'s must be provided, * which will be used to actually create desired metrics (see below) * * <p>AwsSpanMetricsProcessor produces metrics for errors (e.g. HTTP 4XX status codes), faults (e.g. * HTTP 5XX status codes), and latency (in Milliseconds). Errors and faults are counted, while * latency is measured with a histogram. Metrics are emitted with attributes derived from span * attributes. * * <p>For highest fidelity metrics, this processor should be coupled with the {@link AlwaysRecordSampler}, * which will result in 100% of spans being sent to the processor. */ export declare class AwsSpanMetricsProcessor implements SpanProcessor { private NANOS_TO_MILLIS_DIVIDER; private SECONDS_TO_MILLIS_MULTIPLIER; private ERROR_CODE_LOWER_BOUND; private ERROR_CODE_UPPER_BOUND; private FAULT_CODE_LOWER_BOUND; private FAULT_CODE_UPPER_BOUND; private EC2_METADATA_API_IP; private errorHistogram; private faultHistogram; private latencyHistogram; private generator; private resource; private forceFlushFunction; /** Use {@link AwsSpanMetricsProcessorBuilder} to construct this processor. */ static create(errorHistogram: Histogram, faultHistogram: Histogram, latencyHistogram: Histogram, generator: MetricAttributeGenerator, resource: Resource, forceFlushFunction: ForceFlushFunction): AwsSpanMetricsProcessor; private constructor(); onStart(span: Span, parentContext: Context): void; onEnd(span: ReadableSpan): void; private recordErrorOrFault; private recordLatency; private recordMetrics; shutdown(): Promise<void>; forceFlush(): Promise<void>; private isEc2MetadataApiSpan; } //# sourceMappingURL=aws-span-metrics-processor.d.ts.map