aggregate-metric-logger
Advanced tools
Comparing version 1.7.1 to 1.8.0
{ | ||
"name": "aggregate-metric-logger", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"description": "aggregate metrics in memory for logging", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -10,3 +10,7 @@ 'use strict'; | ||
module.exports = ({ enabled = true, namespace = 'aggregate-metric-logger' } = {}) => { | ||
module.exports = ({ | ||
enabled = true, | ||
namespace = 'aggregate-metric-logger', | ||
inProgressMeasurementWarningLimit = 10000 | ||
} = {}) => { | ||
const logger = loggerFactory(namespace); | ||
@@ -21,2 +25,5 @@ | ||
logMetrics(); | ||
if (Object.keys(measurements).length > inProgressMeasurementWarningLimit) { | ||
logger.warn('too-many-in-progress-metric-log-measurments'); | ||
} | ||
metrics = {}; | ||
@@ -23,0 +30,0 @@ setupNextFlush(); |
@@ -256,2 +256,14 @@ 'use strict'; | ||
}); | ||
it('should log warning if there are too many measurments in progress', () => { | ||
jest.spyOn(Logger.prototype, 'warn'); | ||
const metricLogger = metricLoggerFactory({ inProgressMeasurementWarningLimit: 1 }); | ||
metricLogger.measure('kacsa'); | ||
metricLogger.start('nyavogas'); | ||
metricLogger.start('nyavogas'); | ||
clock.tick(60 * 1000); | ||
expect(Logger.prototype.warn).toBeCalledWith('too-many-in-progress-metric-log-measurments'); | ||
}); | ||
}); | ||
@@ -258,0 +270,0 @@ |
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
17886
406