Socket
Socket
Sign inDemoInstall

prometheus-gc-stats

Package Overview
Dependencies
20
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.3.0

26

index.js

@@ -34,7 +34,2 @@ 'use strict';

exports.default = function () {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var _ref$seconds = _ref.seconds;
var seconds = _ref$seconds === undefined ? false : _ref$seconds;
if (typeof gc !== 'function') {

@@ -45,11 +40,5 @@ return noop;

var gcCount = new _counter2.default('nodejs_gc_runs_total', 'Count of total garbage collections.', ['gctype']);
var gcReclaimedCount = new _counter2.default('nodejs_gc_reclaimed_total_bytes', 'Total number of bytes reclaimed by GC.', ['gctype']);
var gcTimeCount = void 0;
var gcTimeCount = new _counter2.default('nodejs_gc_pause_seconds_total', 'Time spent in GC Pause in seconds.', ['gctype']);
var gcReclaimedCount = new _counter2.default('nodejs_gc_reclaimed_bytes_total', 'Total number of bytes reclaimed by GC.', ['gctype']);
if (seconds) {
gcTimeCount = new _counter2.default('nodejs_gc_pause_total_seconds', 'Time spent in GC Pause in seconds.', ['gctype']);
} else {
gcTimeCount = new _counter2.default('nodejs_gc_pause_total_nanoseconds', 'Time spent in GC Pause in nanoseconds.', ['gctype']);
}
var started = false;

@@ -62,12 +51,9 @@

gc().on('stats', function (stats) {
gcCount.labels(gcTypes[stats.gctype]).inc();
var gcType = gcTypes[stats.gctype];
if (seconds) {
gcTimeCount.labels(gcTypes[stats.gctype]).inc(stats.pause / 1e9);
} else {
gcTimeCount.labels(gcTypes[stats.gctype]).inc(stats.pause);
}
gcCount.labels(gcType).inc();
gcTimeCount.labels(gcType).inc(stats.pause / 1e9);
if (stats.diff.usedHeapSize < 0) {
gcReclaimedCount.labels(gcTypes[stats.gctype]).inc(stats.diff.usedHeapSize * -1);
gcReclaimedCount.labels(gcType).inc(stats.diff.usedHeapSize * -1);
}

@@ -74,0 +60,0 @@ });

{
"name": "prometheus-gc-stats",
"version": "0.2.0",
"version": "0.3.0",
"description": "Report Garbage Collection stats using Prometheus",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -21,3 +21,3 @@ # prometheus-gc-stats

The module doing the GC stats collecing is [`gc-stats`](https://github.com/dainis/node-gcstats). This module requires native dependencies.
The module doing the GC stats collecting is [`gc-stats`](https://github.com/dainis/node-gcstats). This module requires native dependencies.
If the stats don't show up, make sure to check `npm`'s install log for failures.

@@ -30,5 +30,4 @@

1. `nodejs_gc_runs_total`: Counts the number of time GC is invoked
2. `nodejs_gc_pause_total_nanoseconds`: Time spent in GC in nanoseconds
1. There's an option that can be passed to the function, `{ seconds: true }` which make this be reported in seconds instead
3. `nodejs_gc_reclaimed_total_bytes`: The number of bytes GC has freed
2. `nodejs_gc_pause_seconds_total`: Time spent in GC in seconds
3. `nodejs_gc_reclaimed_bytes_total`: The number of bytes GC has freed

@@ -35,0 +34,0 @@ ## Credits

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc