Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@opentelemetry/metrics
Advanced tools
OpenTelemetry metrics allow a user to collect data and export it to a metrics backend like Prometheus.
npm install --save @opentelemetry/metrics
Choose this kind of metric when the value is a quantity, the sum is of primary interest, and the event count and value distribution are not of primary interest. Counters are defined as Monotonic = true
by default, meaning that positive values are expected.
const { Meter } = require('@opentelemetry/metrics');
// Initialize the Meter to capture measurements in various ways.
const meter = new Meter();
const counter = meter.createCounter('metric_name', {
labelKeys: ["pid"],
description: "Example of a counter"
});
const labels = meter.labels({ pid: process.pid });
// Create a Handle associated with specified label values.
const handle = counter.getHandle(labels);
handle.add(10);
Gauge metrics express a pre-calculated value. Generally, this kind of metric should be used when the metric cannot be expressed as a sum or because the measurement interval is arbitrary. Use this kind of metric when the measurement is not a quantity, and the sum and event count are not of interest. Gauges are defined as Monotonic = false
by default, meaning that new values are permitted to make positive or negative changes to the gauge. There is no restriction on the sign of the input for gauges.
const { Meter } = require('@opentelemetry/metrics');
// Initialize the Meter to capture measurements in various ways.
const meter = new Meter();
const gauge = meter.createGauge('metric_name', {
labelKeys: ["pid"],
description: "Example of a gauge"
});
const labels = meter.labels({ pid: process.pid });
// Create a Handle associated with specified label values.
const handle = gauge.getHandle(labels);
handle.set(10); // Set to 10
See examples/prometheus for a short example.
Work in progress
Apache 2.0 - See LICENSE for more information.
FAQs
OpenTelemetry metrics SDK
The npm package @opentelemetry/metrics receives a total of 5,664 weekly downloads. As such, @opentelemetry/metrics popularity was classified as popular.
We found that @opentelemetry/metrics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.