This module provides automatic collection of Host Metrics which includes metrics for:
- CPU
- Memory
- Network
Compatible with OpenTelemetry JS API and SDK 1.0+
.
npm install --save @opentelemetry/host-metrics
const { MeterProvider } = require('@opentelemetry/sdk-metrics');
const { HostMetrics } = require('@opentelemetry/host-metrics');
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
const exporter = new PrometheusExporter(
{
startServer: true
}, () => {
console.log('prometheus scrape endpoint: http://localhost:9464/metrics')
}
);
const meterProvider = new MeterProvider();
meterProvider.addMetricReader(exporter);
const hostMetrics = new HostMetrics({ meterProvider, name: 'example-host-metrics' });
hostMetrics.start();
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For help or feedback on this project, join us in GitHub Discussions
APACHE 2.0 - See LICENSE for more information.