Files
discord-decomp/_bundle/CounterMetric.js
T
2026-11-01 12:12:55 +02:00

129 lines
2.9 KiB
JavaScript

// Metro module 6470 (f6471).
import * as _classCallCheck from "./_classCallCheck";
import * as __createClass from "./_createClass";
import { simpleHash } from "./Module6469";
import { COUNTER_METRIC_TYPE, GAUGE_METRIC_TYPE, DISTRIBUTION_METRIC_TYPE, SET_METRIC_TYPE } from "./Module6465";
let GaugeMetric;
let DistributionMetric;
let SetMetric;
let env4166 = {};
const CounterMetric = function CounterMetric(a0) {
"use strict";
_classCallCheck(this, CounterMetric);
this._value = a0;
};
const r6 = __createClass(CounterMetric, [{
key: "weight",
get: function get() {
"use strict";
return 1;
}
}, {
key: "add",
value: function add(a0) {
"use strict";
this._value = this._value + a0;
}
}, {
key: "toString",
value: function toString() {
"use strict";
return `${this._value}`;
}
}]);
GaugeMetric = function GaugeMetric(a0) {
"use strict";
_classCallCheck(this, GaugeMetric);
this._last = a0;
this._min = a0;
this._max = a0;
this._sum = a0;
this._count = 1;
};
const r36 = __createClass(GaugeMetric, [{
key: "weight",
get: function get() {
"use strict";
return 5;
}
}, {
key: "add",
value: function add(a0) {
"use strict";
this._last = a0;
if (a0 < this._min) {
this._min = a0;
}
if (a0 > this._max) {
this._max = a0;
}
this._sum = this._sum + a0;
this._count = this._count + 1;
}
}, {
key: "toString",
value: function toString() {
"use strict";
return `${this._last}:${this._min}:${this._max}:${this._sum}:${this._count}`;
}
}]);
DistributionMetric = function DistributionMetric(a0) {
"use strict";
_classCallCheck(this, DistributionMetric);
this._value = [a0];
};
const r45 = __createClass(DistributionMetric, [{
key: "weight",
get: function get() {
"use strict";
return this._value.length;
}
}, {
key: "add",
value: function add(a0) {
"use strict";
this._value.push(a0);
}
}, {
key: "toString",
value: function toString() {
"use strict";
return this._value.join(":");
}
}]);
SetMetric = function SetMetric(a0) {
"use strict";
_classCallCheck(this, SetMetric);
this.first = a0;
this._value = new Set([a0]);
};
const r54 = __createClass(SetMetric, [{
key: "weight",
get: function get() {
"use strict";
return this._value.size;
}
}, {
key: "add",
value: function add(a0) {
"use strict";
this._value.add(a0);
}
}, {
key: "toString",
value: function toString() {
"use strict";
return Array.from(this._value).map((item) => typeof item === "string" ? simpleHash(item) : item).join(":");
}
}]);
const r55 = {};
r55[COUNTER_METRIC_TYPE] = r6;
r55[GAUGE_METRIC_TYPE] = r36;
r55[DISTRIBUTION_METRIC_TYPE] = r45;
r55[SET_METRIC_TYPE] = r54;
export { r6 as CounterMetric };
export { r45 as DistributionMetric };
export { r36 as GaugeMetric };
export { r55 as METRIC_MAP };
export { r54 as SetMetric };