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.

52 lines 2.56 kB
"use strict"; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.AttributePropagatingSpanProcessorBuilder = void 0; const attribute_propagating_span_processor_1 = require("./attribute-propagating-span-processor"); const aws_attribute_keys_1 = require("./aws-attribute-keys"); const aws_span_processing_util_1 = require("./aws-span-processing-util"); /** * AttributePropagatingSpanProcessorBuilder is used to construct a {@link AttributePropagatingSpanProcessor}. * If {@link setPropagationDataExtractor}, {@link setPropagationDataKey} or {@link setAttributesKeysToPropagate} * are not invoked, the builder defaults to using specific propagation targets. */ class AttributePropagatingSpanProcessorBuilder { constructor() { this.propagationDataExtractor = aws_span_processing_util_1.AwsSpanProcessingUtil.getIngressOperation; this.propagationDataKey = aws_attribute_keys_1.AWS_ATTRIBUTE_KEYS.AWS_LOCAL_OPERATION; this.attributesKeysToPropagate = [ aws_attribute_keys_1.AWS_ATTRIBUTE_KEYS.AWS_REMOTE_SERVICE, aws_attribute_keys_1.AWS_ATTRIBUTE_KEYS.AWS_REMOTE_OPERATION, ]; } static create() { return new AttributePropagatingSpanProcessorBuilder(); } setPropagationDataExtractor(propagationDataExtractor) { if (propagationDataExtractor == null) { throw new Error('propagationDataExtractor must not be null'); } this.propagationDataExtractor = propagationDataExtractor; return this; } setPropagationDataKey(propagationDataKey) { if (propagationDataKey == null) { throw new Error('propagationDataKey must not be null'); } this.propagationDataKey = propagationDataKey; return this; } setAttributesKeysToPropagate(attributesKeysToPropagate) { if (attributesKeysToPropagate == null) { throw new Error('attributesKeysToPropagate must not be null'); } this.attributesKeysToPropagate = [...attributesKeysToPropagate]; return this; } build() { return attribute_propagating_span_processor_1.AttributePropagatingSpanProcessor.create(this.propagationDataExtractor, this.propagationDataKey, this.attributesKeysToPropagate); } } exports.AttributePropagatingSpanProcessorBuilder = AttributePropagatingSpanProcessorBuilder; //# sourceMappingURL=attribute-propagating-span-processor-builder.js.map