@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.
49 lines • 2.1 kB
JavaScript
;
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsoleEMFExporter = void 0;
const emf_exporter_base_1 = require("./emf-exporter-base");
/**
* OpenTelemetry metrics exporter for CloudWatch EMF format to console output.
*
* This exporter converts OTel metrics into CloudWatch EMF logs and writes them
* to standard output instead of sending to CloudWatch Logs. This is useful for
* debugging, testing, or when you want to process EMF logs with other tools.
*
* https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html
*/
class ConsoleEMFExporter extends emf_exporter_base_1.EMFExporterBase {
/**
* Constructor for the Console EMF exporter.
*
* @param namespace CloudWatch namespace for metrics (defaults to "default")
* @param aggregationTemporalitySelector Optional Aggregation temporality selector based on metric instrument types.
* @param aggregationSelector Optional Aggregation selector based on metric instrument types
*/
constructor(namespace = 'default', aggregationTemporalitySelector, aggregationSelector) {
super(namespace, aggregationTemporalitySelector, aggregationSelector);
}
/**
* This method writes the EMF log message to stdout, making it easy to
* capture and redirect the output for processing or debugging purposes.
*
* @param logEvent The log event containing the message to send
* @returns {Promise<void>}
*/
async sendLogEvent(logEvent) {
console.log(logEvent.message);
}
/**
* Force flush any pending metrics.
* For this exporter, there is nothing to forceFlush.
*/
async forceFlush() { }
/**
* Shutdown the exporter.
* For this exporter, there is nothing to clean-up in order to shutdown.
*/
async shutdown() { }
}
exports.ConsoleEMFExporter = ConsoleEMFExporter;
//# sourceMappingURL=console-emf-exporter.js.map