prom-client
Advanced tools
Comparing version 6.2.0 to 6.3.0
'use strict'; | ||
var Counter = require('../counter'); | ||
var PROCESS_CPU_USER_SECONDS = 'process_cpu_user_seconds_total'; | ||
var PROCESS_CPU_SYSTEM_SECONDS = 'process_cpu_system_seconds_total'; | ||
var PROCESS_CPU_SECONDS = 'process_cpu_seconds_total'; | ||
@@ -13,3 +15,9 @@ | ||
var cpuUserCounter = new Counter(PROCESS_CPU_SECONDS, 'Total user and system CPU time spent in seconds.'); | ||
var cpuUserUsageCounter = new Counter(PROCESS_CPU_USER_SECONDS, | ||
'Total user CPU time spent in seconds.'); | ||
var cpuSystemUsageCounter = new Counter(PROCESS_CPU_SYSTEM_SECONDS, | ||
'Total system CPU time spent in seconds.'); | ||
var cpuUsageCounter = new Counter(PROCESS_CPU_SECONDS, | ||
'Total user and system CPU time spent in seconds.'); | ||
var lastCpuUsage = process.cpuUsage(); | ||
@@ -19,10 +27,16 @@ | ||
var cpuUsage = process.cpuUsage(); | ||
var totalUsageMicros = (cpuUsage.user - lastCpuUsage.user) | ||
+ (cpuUsage.system - lastCpuUsage.system); | ||
var userUsageMicros = cpuUsage.user - lastCpuUsage.user; | ||
var systemUsageMicros = cpuUsage.system - lastCpuUsage.system; | ||
lastCpuUsage = cpuUsage; | ||
cpuUserCounter.inc(totalUsageMicros / 1e6); | ||
cpuUserUsageCounter.inc(userUsageMicros / 1e6); | ||
cpuSystemUsageCounter.inc(systemUsageMicros / 1e6); | ||
cpuUsageCounter.inc((userUsageMicros + systemUsageMicros) / 1e6); | ||
}; | ||
}; | ||
module.exports.metricNames = [PROCESS_CPU_SECONDS]; | ||
module.exports.metricNames = [ | ||
PROCESS_CPU_USER_SECONDS, PROCESS_CPU_SYSTEM_SECONDS, PROCESS_CPU_SECONDS | ||
]; |
{ | ||
"name": "prom-client", | ||
"version": "6.2.0", | ||
"version": "6.3.0", | ||
"description": "Client for prometheus", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66630
1577