@artilleryio/int-core 2.20.0 → 2.21.0-28fec46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/ssms.js +17 -7
  2. package/package.json +2 -2
package/lib/ssms.js CHANGED
@@ -12,6 +12,8 @@ const EventEmitter = require('events');
12
12
  const { setDriftlessInterval, clearDriftless } = require('driftless');
13
13
  const debug = require('debug')('ssms');
14
14
 
15
+ const MAX_METRIC_NAME_LENGTH = 1024;
16
+
15
17
  class SSMS extends EventEmitter {
16
18
  constructor(_options) {
17
19
  super();
@@ -153,7 +155,7 @@ class SSMS extends EventEmitter {
153
155
  k.match(/^(http|socketio)\.codes.*/)
154
156
  );
155
157
  for (const n of codeNames) {
156
- const code = parseInt(n.split('.codes.')[1]);
158
+ const code = parseInt(n.split('.codes.')[1], 10);
157
159
  result.codes[code] = pd.counters[n];
158
160
  }
159
161
 
@@ -377,24 +379,32 @@ class SSMS extends EventEmitter {
377
379
 
378
380
  // TODO: Deprecate
379
381
  counter(name, value) {
380
- this.incr(name, value);
382
+ this.incr(name.slice(0, MAX_METRIC_NAME_LENGTH), value);
381
383
  }
382
384
 
383
385
  incr(name, value, t) {
384
- this._counters.push(t || Date.now(), name, value);
386
+ this._counters.push(
387
+ t || Date.now(),
388
+ name.slice(0, MAX_METRIC_NAME_LENGTH),
389
+ value
390
+ );
385
391
  }
386
392
 
387
393
  // TODO: Deprecate
388
394
  summary(name, value) {
389
- this.histogram(name, value);
395
+ this.histogram(name.slice(0, MAX_METRIC_NAME_LENGTH), value);
390
396
  }
391
397
 
392
398
  histogram(name, value, t) {
393
- this._histograms.push(t || Date.now(), name, value);
399
+ this._histograms.push(
400
+ t || Date.now(),
401
+ name.slice(0, MAX_METRIC_NAME_LENGTH),
402
+ value
403
+ );
394
404
  }
395
405
 
396
406
  rate(name, t) {
397
- this._rates.push(t || Date.now(), name);
407
+ this._rates.push(t || Date.now(), name.slice(0, MAX_METRIC_NAME_LENGTH));
398
408
  }
399
409
 
400
410
  getMetrics(period) {
@@ -626,7 +636,7 @@ function summarizeHistogram(h) {
626
636
  min: round(h.min, 1),
627
637
  max: round(h.max, 1),
628
638
  count: h.count,
629
- mean: round(h.sum/h.count, 1),
639
+ mean: round(h.sum / h.count, 1),
630
640
  p50: round(h.getValueAtQuantile(0.5), 1),
631
641
  median: round(h.getValueAtQuantile(0.5), 1), // Here for compatibility
632
642
  p75: round(h.getValueAtQuantile(0.75), 1),
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@artilleryio/int-core",
3
- "version": "2.20.0",
3
+ "version": "2.21.0-28fec46",
4
4
  "main": "./index.js",
5
5
  "license": "MPL-2.0",
6
6
  "dependencies": {
7
- "@artilleryio/int-commons": "2.16.0",
7
+ "@artilleryio/int-commons": "2.17.0-28fec46",
8
8
  "@artilleryio/sketches-js": "^2.1.1",
9
9
  "agentkeepalive": "^4.1.0",
10
10
  "arrivals": "^2.1.2",