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.

34 lines 1.4 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.SecretsManagerServiceExtension = void 0; const api_1 = require("@opentelemetry/api"); const aws_attribute_keys_1 = require("../../../aws-attribute-keys"); class SecretsManagerServiceExtension { requestPreSpanHook(request, _config) { var _a; const secretId = (_a = request.commandInput) === null || _a === void 0 ? void 0 : _a.SecretId; const spanKind = api_1.SpanKind.CLIENT; let spanName; const spanAttributes = {}; if (typeof secretId === 'string' && secretId.startsWith('arn:aws:secretsmanager:')) { spanAttributes[aws_attribute_keys_1.AWS_ATTRIBUTE_KEYS.AWS_SECRETSMANAGER_SECRET_ARN] = secretId; } const isIncoming = false; return { isIncoming, spanAttributes, spanKind, spanName, }; } responseHook(response, span, tracer, config) { const secretArn = response.data.ARN; if (secretArn) { span.setAttribute(aws_attribute_keys_1.AWS_ATTRIBUTE_KEYS.AWS_SECRETSMANAGER_SECRET_ARN, secretArn); } } } exports.SecretsManagerServiceExtension = SecretsManagerServiceExtension; //# sourceMappingURL=secretsmanager.js.map