@opentelemetry/host-metrics

OpenTelemetry Host Metrics for Node.js

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@opentelemetry/host-metrics
347950.30.023 days ago2 years agoMinified + gzip package size for @opentelemetry/host-metrics in KB

Readme

OpenTelemetry Host Metrics for Node.js
!NPM Published Versionnpm-imgnpm-url !Apache Licenselicense-imagelicense-url
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-base');
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({
  exporter,
  interval: 2000,
});

const hostMetrics = new HostMetrics({ meterProvider, name: 'example-host-metrics' });
hostMetrics.start();

Useful links

  • For more information on OpenTelemetry, visit:
  • For more about OpenTelemetry JavaScript:
  • For help or feedback on this project, join us in GitHub Discussionsdiscussions-url

License

APACHE 2.0 - See LICENSElicense-url for more information.