@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.
27 lines • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OTLPAwsLogExporter = void 0;
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
const exporter_logs_otlp_proto_1 = require("@opentelemetry/exporter-logs-otlp-proto");
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
const otlp_aws_base_exporter_1 = require("../common/otlp-aws-base-exporter");
/**
* This exporter extends the functionality of the OTLPProtoLogExporter to allow logs to be exported
* to the CloudWatch Logs OTLP endpoint https://logs.[AWSRegion].amazonaws.com/v1/logs. Utilizes the aws-sdk
* library to sign and directly inject SigV4 Authentication to the exported request's headers. <a
* href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-OTLPEndpoint.html">...</a>
*
* This only works with version >=16 Node.js environments.
* @param endpoint - The AWS CloudWatch Logs OTLP endpoint URL
* @param config - Optional OTLP exporter configuration
*/
class OTLPAwsLogExporter extends otlp_aws_base_exporter_1.OTLPAwsBaseExporter {
constructor(endpoint, config) {
const modifiedConfig = Object.assign(Object.assign({}, config), { url: endpoint, compression: otlp_exporter_base_1.CompressionAlgorithm.NONE });
super(endpoint, 'logs', new exporter_logs_otlp_proto_1.OTLPLogExporter(modifiedConfig), otlp_transformer_1.ProtobufLogsSerializer, config === null || config === void 0 ? void 0 : config.compression);
}
}
exports.OTLPAwsLogExporter = OTLPAwsLogExporter;
//# sourceMappingURL=otlp-aws-log-exporter.js.map