veryfront 0.1.913 → 0.1.914
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.
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/metrics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,yBAAyB,CAAC;AAcjC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/metrics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,yBAAyB,CAAC;AAcjC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA6XD,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,KAAK,SAAI,EACT,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAON;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAON;AAED,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,uBAAuB,GAChC,IAAI,CAaN;AAED,eAAO,MAAM,OAAO;;;;uBAIO,OAAO,CAAC,IAAI,CAAC;uBAGnB,IAAI;CAYxB,CAAC"}
|
package/esm/src/metrics/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const histograms = new Map();
|
|
|
21
21
|
const gauges = new Map();
|
|
22
22
|
const directQueue = [];
|
|
23
23
|
const directCounterTotals = new Map();
|
|
24
|
+
const directHistogramTotals = new Map();
|
|
24
25
|
let directFlushTimer = null;
|
|
25
26
|
const DIRECT_FLUSH_DELAY_MS = 1_000;
|
|
26
27
|
const DIRECT_MAX_BATCH_SIZE = 100;
|
|
@@ -209,19 +210,31 @@ function buildDirectMetric(sample) {
|
|
|
209
210
|
};
|
|
210
211
|
}
|
|
211
212
|
if (sample.kind === "histogram") {
|
|
213
|
+
const key = `${sample.name}:${attributesKey(sample.attributes)}`;
|
|
214
|
+
const total = directHistogramTotals.get(key) ?? {
|
|
215
|
+
count: 0,
|
|
216
|
+
sum: 0,
|
|
217
|
+
bucketCounts: new Array(HISTOGRAM_BOUNDS.length + 1).fill(0),
|
|
218
|
+
startTimeUnixNano: sample.timestampUnixNano,
|
|
219
|
+
};
|
|
220
|
+
const sampleBuckets = buildHistogramBuckets(sample.value);
|
|
221
|
+
total.count += 1;
|
|
222
|
+
total.sum += sample.value;
|
|
223
|
+
total.bucketCounts = total.bucketCounts.map((count, index) => count + sampleBuckets[index]);
|
|
224
|
+
directHistogramTotals.set(key, total);
|
|
212
225
|
return {
|
|
213
226
|
name: sample.name,
|
|
214
227
|
histogram: {
|
|
215
228
|
dataPoints: [{
|
|
216
229
|
attributes,
|
|
217
|
-
startTimeUnixNano:
|
|
230
|
+
startTimeUnixNano: total.startTimeUnixNano,
|
|
218
231
|
timeUnixNano: sample.timestampUnixNano,
|
|
219
|
-
count:
|
|
220
|
-
sum:
|
|
232
|
+
count: total.count,
|
|
233
|
+
sum: total.sum,
|
|
221
234
|
explicitBounds: HISTOGRAM_BOUNDS,
|
|
222
|
-
bucketCounts:
|
|
235
|
+
bucketCounts: total.bucketCounts,
|
|
223
236
|
}],
|
|
224
|
-
aggregationTemporality:
|
|
237
|
+
aggregationTemporality: 2,
|
|
225
238
|
},
|
|
226
239
|
};
|
|
227
240
|
}
|
|
@@ -369,6 +382,7 @@ export const metrics = {
|
|
|
369
382
|
gauges.clear();
|
|
370
383
|
directQueue.length = 0;
|
|
371
384
|
directCounterTotals.clear();
|
|
385
|
+
directHistogramTotals.clear();
|
|
372
386
|
if (directFlushTimer) {
|
|
373
387
|
clearTimeout(directFlushTimer);
|
|
374
388
|
directFlushTimer = null;
|