Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@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 { MeterProvider } = require('@opentelemetry/metrics');
// Initialize the Meter to capture measurements in various ways.
const meter = new MeterProvider().getMeter('your-meter-name');
const counter = meter.createCounter('metric_name', {
description: 'Example of a counter'
});
const labels = { pid: process.pid };
// Create a BoundInstrument associated with specified label values.
const boundCounter = counter.bind(labels);
boundCounter.add(10);
Choose this kind of metric when only last value is important without worry about aggregation
const { MeterProvider, MetricObservable } = require('@opentelemetry/metrics');
// Initialize the Meter to capture measurements in various ways.
const meter = new MeterProvider().getMeter('your-meter-name');
const observer = meter.createObserver('metric_name', {
description: 'Example of a observer'
});
function getCpuUsage() {
return Math.random();
}
const metricObservable = new MetricObservable();
observer.setCallback((observerResult) => {
// synchronous callback
observerResult.observe(getCpuUsage, { pid: process.pid, core: '1' });
// asynchronous callback
observerResult.observe(metricObservable, { pid: process.pid, core: '2' });
});
// simulate asynchronous operation
setInterval(()=> {
metricObservable.next(getCpuUsage());
}, 2000)
See examples/prometheus for a short example.
ValueRecorder
is a non-additive synchronous instrument useful for recording any non-additive number, positive or negative.
Values captured by ValueRecorder.record(value)
are treated as individual events belonging to a distribution that is being summarized.
ValueRecorder
should be chosen either when capturing measurements that do not contribute meaningfully to a sum, or when capturing numbers that are additive in nature, but where the distribution of individual increments is considered interesting.
Apache 2.0 - See LICENSE for more information.
0.9.0
opentelemetry-api
, opentelemetry-exporter-prometheus
, opentelemetry-metrics
opentelemetry-api
, opentelemetry-metrics
opentelemetry-api
, opentelemetry-core
, opentelemetry-tracing
opentelemetry-plugin-fetch
, opentelemetry-plugin-xml-http-request
, opentelemetry-web
opentelemetry-node
opentelemetry-exporter-jaeger
opentelemetry-exporter-zipkin
opentelemetry-plugin-xml-http-request
opentelemetry-metrics
opentelemetry-exporter-collector
opentelemetry-exporter-zipkin
opentelemetry-exporter-collector
opentelemetry-context-zone-peer-dep
opentelemetry-semantic-conventions
FAQs
OpenTelemetry metrics SDK
The npm package @opentelemetry/metrics receives a total of 3,871 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.