0.35.1 • Published 13 days ago

@opentelemetry/host-metrics v0.35.1

Weekly downloads
143
License
Apache-2.0
Repository
github
Last release
13 days ago

OpenTelemetry Host Metrics for Node.js

NPM Published Version Apache License

This module provides automatic collection of Host Metrics which includes metrics for:

  • CPU
  • Memory
  • Network

Compatible with OpenTelemetry JS API and SDK 1.0+.

Installation

npm install --save @opentelemetry/host-metrics

Usage

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();

Useful links

License

APACHE 2.0 - See LICENSE for more information.