Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

aggregate-metric-logger

Package Overview
Dependencies
29
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.1 to 1.6.0

2

package.json
{
"name": "aggregate-metric-logger",
"version": "1.5.1",
"version": "1.6.0",
"description": "aggregate metrics in memory for logging",

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

@@ -36,8 +36,7 @@ 'use strict';

const newCounts = {};
thresholds.forEach(threshold => {
return fromPairs(thresholds.map(threshold => {
const previousCount = countsSoFar[threshold] || 0;
newCounts[threshold] = value < threshold ? previousCount + 1 : previousCount;
});
return newCounts;
const newCount = value > threshold ? previousCount + 1 : previousCount;
return [threshold, newCount];
}));
};

@@ -83,3 +82,3 @@

...fromPairs(
toPairs(metrics.thresholdCounts).map(([limit, count]) => [`below_${limit}`, count])
toPairs(metrics.thresholdCounts).map(([limit, count]) => [`above_${limit}`, count])
)

@@ -86,0 +85,0 @@ };

@@ -95,3 +95,3 @@ 'use strict';

it('should count event distribution within specified thresholds', () => {
metricLogger.setThresholds('etwas', [1, 10, 20]);
metricLogger.setThresholds('etwas', [5, 10, 20, 1000]);

@@ -101,6 +101,6 @@ metricLogger.measure('etwas', 2);

metricLogger.measure('etwas', 4);
metricLogger.measure('etwas', 4);
metricLogger.measure('etwas', 6);
metricLogger.measure('etwas', 11);
metricLogger.measure('etwas', 12);
metricLogger.measure('etwas', 818);
metricLogger.measure('etwas', 816);

@@ -110,9 +110,10 @@ clock.tick(60 * 1000 + 1);

min: 2,
max: 818,
max: 816,
count: 7,
sum: 854,
average: 122,
below_1: 0,
below_10: 4,
below_20: 6
above_5: 4,
above_10: 3,
above_20: 1,
above_1000: 0
});

@@ -119,0 +120,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc