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.

55 lines 2.54 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.SamplingRule = void 0; class SamplingRule { constructor(samplingRule) { // The AWS API docs mark `RuleName` as an optional field but in practice it seems to always be // present, and sampling targets could not be computed without it. For now provide an arbitrary fallback just in // case the AWS API docs are correct. this.RuleName = samplingRule.RuleName ? samplingRule.RuleName : 'Default'; this.RuleARN = samplingRule.RuleARN; this.Priority = samplingRule.Priority; this.ReservoirSize = samplingRule.ReservoirSize; this.FixedRate = samplingRule.FixedRate; this.ServiceName = samplingRule.ServiceName; this.ServiceType = samplingRule.ServiceType; this.Host = samplingRule.Host; this.HTTPMethod = samplingRule.HTTPMethod; this.URLPath = samplingRule.URLPath; this.ResourceARN = samplingRule.ResourceARN; this.Version = samplingRule.Version; this.Attributes = samplingRule.Attributes; } equals(other) { let attributesEquals; if (this.Attributes === undefined || other.Attributes === undefined) { attributesEquals = this.Attributes === other.Attributes; } else { attributesEquals = this.Attributes.length === other.Attributes.length; for (const attributeKey in other.Attributes) { if (!(attributeKey in this.Attributes) || this.Attributes[attributeKey] !== other.Attributes[attributeKey]) { attributesEquals = false; break; } } } return (this.FixedRate === other.FixedRate && this.HTTPMethod === other.HTTPMethod && this.Host === other.Host && this.Priority === other.Priority && this.ReservoirSize === other.ReservoirSize && this.ResourceARN === other.ResourceARN && this.RuleARN === other.RuleARN && this.RuleName === other.RuleName && this.ServiceName === other.ServiceName && this.ServiceType === other.ServiceType && this.URLPath === other.URLPath && this.Version === other.Version && attributesEquals); } } exports.SamplingRule = SamplingRule; //# sourceMappingURL=sampling-rule.js.map