@opentelemetry/host-metrics
TypeScript icon, indicating that this package has built-in type declarations

0.35.0 • Public • Published

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.

Package Sidebar

Install

npm i @opentelemetry/host-metrics

Weekly Downloads

59,562

Version

0.35.0

License

Apache-2.0

Unpacked Size

80.1 kB

Total Files

30

Last publish

Collaborators

  • pichlermarc
  • bogdandrutu
  • dyladan