@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.
90 lines • 4.59 kB
TypeScript
import { Context } from '@opentelemetry/api';
import type { ReadableSpan, Span } from '@opentelemetry/sdk-trace-base';
export type ForceFlushFunction = (options?: any) => Promise<void>;
/** Utility class designed to support shared logic across AWS Span Processors. */
export declare class AwsSpanProcessingUtil {
static UNKNOWN_SERVICE: string;
static UNKNOWN_OPERATION: string;
static UNKNOWN_REMOTE_SERVICE: string;
static UNKNOWN_REMOTE_OPERATION: string;
static INTERNAL_OPERATION: string;
static LOCAL_ROOT: string;
static SQS_RECEIVE_MESSAGE_SPAN_NAME: string;
static AWS_SDK_INSTRUMENTATION_SCOPE_PREFIX: string;
static CLOUD_RESOURCE_ID: string;
static MAX_KEYWORD_LENGTH: number;
static SQL_DIALECT_PATTERN: string;
static GEN_AI_REQUEST_MODEL: string;
static OTEL_AWS_HTTP_OPERATION_PATHS_CONFIG: string;
private static operationPaths;
/**
* Parse the OTEL_AWS_HTTP_OPERATION_PATHS env var into a sorted list of path templates
* (longest first by segment count). Returns an empty array if the env var is not set.
*/
static getOperationPaths(): string[];
/** Reset cached operation paths (for testing). */
static resetOperationPaths(): void;
/**
* If OTEL_AWS_HTTP_OPERATION_PATHS is configured and a pattern matches the span's URL path,
* mutates the span name to "METHOD /path/template". Returns the span unchanged if no config
* is set or no pattern matches.
*/
static applyOperationPathSpanName(span: ReadableSpan): ReadableSpan;
/** Return the URL path from server span attributes, preferring url.path over http.target. */
private static getUrlPath;
/** Get the HTTP method from the span, checking new and deprecated semconv attributes. */
private static getHttpMethod;
/**
* Check if URL segments match a pattern's segments. Only pattern segments can be wildcards
* ({param}, :param, or *) — URL segments are always treated as literals. The pattern acts
* as a prefix — extra URL segments after the pattern are allowed.
*/
private static segmentsMatch;
/** A segment is a wildcard if it uses {param}, :param, or * format. */
private static isWildcardSegment;
static GEN_AI_SYSTEM: string;
static GEN_AI_REQUEST_MAX_TOKENS: string;
static GEN_AI_REQUEST_TEMPERATURE: string;
static GEN_AI_REQUEST_TOP_P: string;
static GEN_AI_RESPONSE_FINISH_REASONS: string;
static GEN_AI_USAGE_INPUT_TOKENS: string;
static GEN_AI_USAGE_OUTPUT_TOKENS: string;
static getDialectKeywords(): string[];
/**
* Ingress operation (i.e. operation for Server and Consumer spans) will be generated from
* "http.method + http.target/with the first API path parameter" if the default span name equals
* null, UnknownOperation or http.method value.
*/
static getIngressOperation(span: ReadableSpan): string;
static getEgressOperation(span: ReadableSpan): string | undefined;
/**
* Extract the first part from API http target if it exists
*
* @param httpTarget http request target string value. Eg, /payment/1234
* @return the first part from the http target. Eg, /payment
*/
static extractAPIPathValue(httpTarget: string | undefined | null): string;
static isKeyPresent(span: ReadableSpan, key: string): boolean;
static isAwsSDKSpan(span: ReadableSpan): boolean;
static shouldGenerateServiceMetricAttributes(span: ReadableSpan): boolean;
static shouldGenerateDependencyMetricAttributes(span: ReadableSpan): boolean;
static isConsumerProcessSpan(spanData: ReadableSpan): boolean;
static shouldUseInternalOperation(span: ReadableSpan): boolean;
static isLocalRoot(spanData: ReadableSpan): boolean;
private static isSqsReceiveMessageConsumerSpan;
private static isDependencyConsumerSpan;
/**
* When Span name is null, UnknownOperation or HttpMethod value, it will be treated as invalid
* local operation value that needs to be further processed
*/
private static isValidOperation;
/**
* When span name is not meaningful(null, unknown or http_method value) as operation name for http
* use cases. Will try to extract the operation name from http target string
*/
private static generateIngressOperation;
static isDBSpan(span: ReadableSpan): boolean;
static setIsLocalRootInformation(span: Span, parentContext: Context): void;
static getResourceId(span: ReadableSpan): string | undefined;
}
//# sourceMappingURL=aws-span-processing-util.d.ts.map