Erster Docker-Stand
This commit is contained in:
53
_node_modules/effect/dist/cjs/internal/metric/boundaries.js
generated
vendored
Normal file
53
_node_modules/effect/dist/cjs/internal/metric/boundaries.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.linear = exports.isMetricBoundaries = exports.fromIterable = exports.exponential = exports.MetricBoundariesTypeId = void 0;
|
||||
var Arr = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricBoundariesSymbolKey = "effect/MetricBoundaries";
|
||||
/** @internal */
|
||||
const MetricBoundariesTypeId = exports.MetricBoundariesTypeId = /*#__PURE__*/Symbol.for(MetricBoundariesSymbolKey);
|
||||
/** @internal */
|
||||
class MetricBoundariesImpl {
|
||||
values;
|
||||
[MetricBoundariesTypeId] = MetricBoundariesTypeId;
|
||||
constructor(values) {
|
||||
this.values = values;
|
||||
this._hash = (0, _Function.pipe)(Hash.string(MetricBoundariesSymbolKey), Hash.combine(Hash.array(this.values)));
|
||||
}
|
||||
_hash;
|
||||
[Hash.symbol]() {
|
||||
return this._hash;
|
||||
}
|
||||
[Equal.symbol](u) {
|
||||
return isMetricBoundaries(u) && Equal.equals(this.values, u.values);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const isMetricBoundaries = u => (0, _Predicate.hasProperty)(u, MetricBoundariesTypeId);
|
||||
/** @internal */
|
||||
exports.isMetricBoundaries = isMetricBoundaries;
|
||||
const fromIterable = iterable => {
|
||||
const values = (0, _Function.pipe)(iterable, Arr.appendAll(Chunk.of(Number.POSITIVE_INFINITY)), Arr.dedupe);
|
||||
return new MetricBoundariesImpl(values);
|
||||
};
|
||||
/** @internal */
|
||||
exports.fromIterable = fromIterable;
|
||||
const linear = options => (0, _Function.pipe)(Arr.makeBy(options.count - 1, i => options.start + i * options.width), Chunk.unsafeFromArray, fromIterable);
|
||||
/** @internal */
|
||||
exports.linear = linear;
|
||||
const exponential = options => (0, _Function.pipe)(Arr.makeBy(options.count - 1, i => options.start * Math.pow(options.factor, i)), Chunk.unsafeFromArray, fromIterable);
|
||||
exports.exponential = exponential;
|
||||
//# sourceMappingURL=boundaries.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/boundaries.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/boundaries.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"boundaries.js","names":["Arr","_interopRequireWildcard","require","Chunk","Equal","_Function","Hash","_Pipeable","_Predicate","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MetricBoundariesSymbolKey","MetricBoundariesTypeId","exports","Symbol","for","MetricBoundariesImpl","values","constructor","_hash","pipe","string","combine","array","symbol","u","isMetricBoundaries","equals","pipeArguments","arguments","hasProperty","fromIterable","iterable","appendAll","of","Number","POSITIVE_INFINITY","dedupe","linear","options","makeBy","count","start","width","unsafeFromArray","exponential","Math","pow","factor"],"sources":["../../../../src/internal/metric/boundaries.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAL,uBAAA,CAAAC,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAgD,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAA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C,MAAM,CAACC,iBAAiB,CAAC,CAAC,EACjDrD,GAAG,CAACsD,MAAM,CACX;EACD,OAAO,IAAIrB,oBAAoB,CAACC,MAAM,CAAC;AACzC,CAAC;AAED;AAAAJ,OAAA,CAAAkB,YAAA,GAAAA,YAAA;AACO,MAAMO,MAAM,GAAIC,OAItB,IACC,IAAAnB,cAAI,EACFrC,GAAG,CAACyD,MAAM,CAACD,OAAO,CAACE,KAAK,GAAG,CAAC,EAAG1C,CAAC,IAAKwC,OAAO,CAACG,KAAK,GAAG3C,CAAC,GAAGwC,OAAO,CAACI,KAAK,CAAC,EACvEzD,KAAK,CAAC0D,eAAe,EACrBb,YAAY,CACb;AAEH;AAAAlB,OAAA,CAAAyB,MAAA,GAAAA,MAAA;AACO,MAAMO,WAAW,GAAIN,OAI3B,IACC,IAAAnB,cAAI,EACFrC,GAAG,CAACyD,MAAM,CAACD,OAAO,CAACE,KAAK,GAAG,CAAC,EAAG1C,CAAC,IAAKwC,OAAO,CAACG,KAAK,GAAGI,IAAI,CAACC,GAAG,CAACR,OAAO,CAACS,MAAM,EAAEjD,CAAC,CAAC,CAAC,EACjFb,KAAK,CAAC0D,eAAe,EACrBb,YAAY,CACb;AAAAlB,OAAA,CAAAgC,WAAA,GAAAA,WAAA","ignoreList":[]}
|
||||
388
_node_modules/effect/dist/cjs/internal/metric/hook.js
generated
vendored
Normal file
388
_node_modules/effect/dist/cjs/internal/metric/hook.js
generated
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.summary = exports.onUpdate = exports.onModify = exports.make = exports.histogram = exports.gauge = exports.frequency = exports.counter = exports.MetricHookTypeId = void 0;
|
||||
var Arr = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Duration = _interopRequireWildcard(require("../../Duration.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var number = _interopRequireWildcard(require("../../Number.js"));
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var metricState = _interopRequireWildcard(require("./state.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricHookSymbolKey = "effect/MetricHook";
|
||||
/** @internal */
|
||||
const MetricHookTypeId = exports.MetricHookTypeId = /*#__PURE__*/Symbol.for(MetricHookSymbolKey);
|
||||
const metricHookVariance = {
|
||||
/* c8 ignore next */
|
||||
_In: _ => _,
|
||||
/* c8 ignore next */
|
||||
_Out: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const make = options => ({
|
||||
[MetricHookTypeId]: metricHookVariance,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
...options
|
||||
});
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const onModify = exports.onModify = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => ({
|
||||
[MetricHookTypeId]: metricHookVariance,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
get: self.get,
|
||||
update: self.update,
|
||||
modify: input => {
|
||||
self.modify(input);
|
||||
return f(input);
|
||||
}
|
||||
}));
|
||||
/** @internal */
|
||||
const onUpdate = exports.onUpdate = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => ({
|
||||
[MetricHookTypeId]: metricHookVariance,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
get: self.get,
|
||||
update: input => {
|
||||
self.update(input);
|
||||
return f(input);
|
||||
},
|
||||
modify: self.modify
|
||||
}));
|
||||
const bigint0 = /*#__PURE__*/BigInt(0);
|
||||
/** @internal */
|
||||
const counter = key => {
|
||||
let sum = key.keyType.bigint ? bigint0 : 0;
|
||||
const canUpdate = key.keyType.incremental ? key.keyType.bigint ? value => value >= bigint0 : value => value >= 0 : _value => true;
|
||||
const update = value => {
|
||||
if (canUpdate(value)) {
|
||||
sum = sum + value;
|
||||
}
|
||||
};
|
||||
return make({
|
||||
get: () => metricState.counter(sum),
|
||||
update,
|
||||
modify: update
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.counter = counter;
|
||||
const frequency = key => {
|
||||
const values = new Map();
|
||||
for (const word of key.keyType.preregisteredWords) {
|
||||
values.set(word, 0);
|
||||
}
|
||||
const update = word => {
|
||||
const slotCount = values.get(word) ?? 0;
|
||||
values.set(word, slotCount + 1);
|
||||
};
|
||||
return make({
|
||||
get: () => metricState.frequency(values),
|
||||
update,
|
||||
modify: update
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.frequency = frequency;
|
||||
const gauge = (_key, startAt) => {
|
||||
let value = startAt;
|
||||
return make({
|
||||
get: () => metricState.gauge(value),
|
||||
update: v => {
|
||||
value = v;
|
||||
},
|
||||
modify: v => {
|
||||
value = value + v;
|
||||
}
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.gauge = gauge;
|
||||
const histogram = key => {
|
||||
const bounds = key.keyType.boundaries.values;
|
||||
const size = bounds.length;
|
||||
const values = new Uint32Array(size + 1);
|
||||
// NOTE: while 64-bit floating point precision shoule be enough for any
|
||||
// practical histogram boundary values, there is still a small chance that
|
||||
// precision will be lost with very large / very small numbers. If we find
|
||||
// that is the case, a more complex approach storing the histogram boundary
|
||||
// values as a tuple of `[original: string, numeric: number]` may be warranted
|
||||
const boundaries = new Float64Array(size);
|
||||
let count = 0;
|
||||
let sum = 0;
|
||||
let min = Number.MAX_VALUE;
|
||||
let max = Number.MIN_VALUE;
|
||||
(0, _Function.pipe)(bounds, Arr.sort(number.Order), Arr.map((n, i) => {
|
||||
boundaries[i] = n;
|
||||
}));
|
||||
// Insert the value into the right bucket with a binary search
|
||||
const update = value => {
|
||||
let from = 0;
|
||||
let to = size;
|
||||
while (from !== to) {
|
||||
const mid = Math.floor(from + (to - from) / 2);
|
||||
const boundary = boundaries[mid];
|
||||
if (value <= boundary) {
|
||||
to = mid;
|
||||
} else {
|
||||
from = mid;
|
||||
}
|
||||
// The special case when to / from have a distance of one
|
||||
if (to === from + 1) {
|
||||
if (value <= boundaries[from]) {
|
||||
to = from;
|
||||
} else {
|
||||
from = to;
|
||||
}
|
||||
}
|
||||
}
|
||||
values[from] = values[from] + 1;
|
||||
count = count + 1;
|
||||
sum = sum + value;
|
||||
if (value < min) {
|
||||
min = value;
|
||||
}
|
||||
if (value > max) {
|
||||
max = value;
|
||||
}
|
||||
};
|
||||
const getBuckets = () => {
|
||||
const builder = Arr.allocate(size);
|
||||
let cumulated = 0;
|
||||
for (let i = 0; i < size; i++) {
|
||||
const boundary = boundaries[i];
|
||||
const value = values[i];
|
||||
cumulated = cumulated + value;
|
||||
builder[i] = [boundary, cumulated];
|
||||
}
|
||||
return builder;
|
||||
};
|
||||
return make({
|
||||
get: () => metricState.histogram({
|
||||
buckets: getBuckets(),
|
||||
count,
|
||||
min,
|
||||
max,
|
||||
sum
|
||||
}),
|
||||
update,
|
||||
modify: update
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.histogram = histogram;
|
||||
const summary = key => {
|
||||
const {
|
||||
error,
|
||||
maxAge,
|
||||
maxSize,
|
||||
quantiles
|
||||
} = key.keyType;
|
||||
const sortedQuantiles = (0, _Function.pipe)(quantiles, Arr.sort(number.Order));
|
||||
const values = Arr.allocate(maxSize);
|
||||
let head = 0;
|
||||
let count = 0;
|
||||
let sum = 0;
|
||||
let min = 0;
|
||||
let max = 0;
|
||||
// Just before the snapshot we filter out all values older than maxAge
|
||||
const snapshot = now => {
|
||||
const builder = [];
|
||||
// If the buffer is not full yet it contains valid items at the 0..last
|
||||
// indices and null values at the rest of the positions.
|
||||
//
|
||||
// If the buffer is already full then all elements contains a valid
|
||||
// measurement with timestamp.
|
||||
//
|
||||
// At any given point in time we can enumerate all the non-null elements in
|
||||
// the buffer and filter them by timestamp to get a valid view of a time
|
||||
// window.
|
||||
//
|
||||
// The order does not matter because it gets sorted before passing to
|
||||
// `calculateQuantiles`.
|
||||
let i = 0;
|
||||
while (i !== maxSize - 1) {
|
||||
const item = values[i];
|
||||
if (item != null) {
|
||||
const [t, v] = item;
|
||||
const age = Duration.millis(now - t);
|
||||
if (Duration.greaterThanOrEqualTo(age, Duration.zero) && Duration.lessThanOrEqualTo(age, maxAge)) {
|
||||
builder.push(v);
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
return calculateQuantiles(error, sortedQuantiles, Arr.sort(builder, number.Order));
|
||||
};
|
||||
const observe = (value, timestamp) => {
|
||||
if (maxSize > 0) {
|
||||
head = head + 1;
|
||||
const target = head % maxSize;
|
||||
values[target] = [timestamp, value];
|
||||
}
|
||||
min = count === 0 ? value : Math.min(min, value);
|
||||
max = count === 0 ? value : Math.max(max, value);
|
||||
count = count + 1;
|
||||
sum = sum + value;
|
||||
};
|
||||
return make({
|
||||
get: () => metricState.summary({
|
||||
error,
|
||||
quantiles: snapshot(Date.now()),
|
||||
count,
|
||||
min,
|
||||
max,
|
||||
sum
|
||||
}),
|
||||
update: ([value, timestamp]) => observe(value, timestamp),
|
||||
modify: ([value, timestamp]) => observe(value, timestamp)
|
||||
});
|
||||
};
|
||||
/** @internal */
|
||||
exports.summary = summary;
|
||||
const calculateQuantiles = (error, sortedQuantiles, sortedSamples) => {
|
||||
// The number of samples examined
|
||||
const sampleCount = sortedSamples.length;
|
||||
if (!Arr.isNonEmptyReadonlyArray(sortedQuantiles)) {
|
||||
return Arr.empty();
|
||||
}
|
||||
const head = sortedQuantiles[0];
|
||||
const tail = sortedQuantiles.slice(1);
|
||||
const resolvedHead = resolveQuantile(error, sampleCount, Option.none(), 0, head, sortedSamples);
|
||||
const resolved = Arr.of(resolvedHead);
|
||||
tail.forEach(quantile => {
|
||||
resolved.push(resolveQuantile(error, sampleCount, resolvedHead.value, resolvedHead.consumed, quantile, resolvedHead.rest));
|
||||
});
|
||||
return Arr.map(resolved, rq => [rq.quantile, rq.value]);
|
||||
};
|
||||
/** @internal */
|
||||
const resolveQuantile = (error, sampleCount, current, consumed, quantile, rest) => {
|
||||
let error_1 = error;
|
||||
let sampleCount_1 = sampleCount;
|
||||
let current_1 = current;
|
||||
let consumed_1 = consumed;
|
||||
let quantile_1 = quantile;
|
||||
let rest_1 = rest;
|
||||
let error_2 = error;
|
||||
let sampleCount_2 = sampleCount;
|
||||
let current_2 = current;
|
||||
let consumed_2 = consumed;
|
||||
let quantile_2 = quantile;
|
||||
let rest_2 = rest;
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (1) {
|
||||
// If the remaining list of samples is empty, there is nothing more to resolve
|
||||
if (!Arr.isNonEmptyReadonlyArray(rest_1)) {
|
||||
return {
|
||||
quantile: quantile_1,
|
||||
value: Option.none(),
|
||||
consumed: consumed_1,
|
||||
rest: []
|
||||
};
|
||||
}
|
||||
// If the quantile is the 100% quantile, we can take the maximum of all the
|
||||
// remaining values as the result
|
||||
if (quantile_1 === 1) {
|
||||
return {
|
||||
quantile: quantile_1,
|
||||
value: Option.some(Arr.lastNonEmpty(rest_1)),
|
||||
consumed: consumed_1 + rest_1.length,
|
||||
rest: []
|
||||
};
|
||||
}
|
||||
// Split into two chunks - the first chunk contains all elements of the same
|
||||
// value as the chunk head
|
||||
const headValue = Arr.headNonEmpty(rest_1); // Get head value since rest_1 is non-empty
|
||||
const sameHead = Arr.span(rest_1, n => n === headValue);
|
||||
// How many elements do we want to accept for this quantile
|
||||
const desired = quantile_1 * sampleCount_1;
|
||||
// The error margin
|
||||
const allowedError = error_1 / 2 * desired;
|
||||
// Taking into account the elements consumed from the samples so far and the
|
||||
// number of same elements at the beginning of the chunk, calculate the number
|
||||
// of elements we would have if we selected the current head as result
|
||||
const candConsumed = consumed_1 + sameHead[0].length;
|
||||
const candError = Math.abs(candConsumed - desired);
|
||||
// If we haven't got enough elements yet, recurse
|
||||
if (candConsumed < desired - allowedError) {
|
||||
error_2 = error_1;
|
||||
sampleCount_2 = sampleCount_1;
|
||||
current_2 = Arr.head(rest_1);
|
||||
consumed_2 = candConsumed;
|
||||
quantile_2 = quantile_1;
|
||||
rest_2 = sameHead[1];
|
||||
error_1 = error_2;
|
||||
sampleCount_1 = sampleCount_2;
|
||||
current_1 = current_2;
|
||||
consumed_1 = consumed_2;
|
||||
quantile_1 = quantile_2;
|
||||
rest_1 = rest_2;
|
||||
continue;
|
||||
}
|
||||
// If consuming this chunk leads to too many elements (rank is too high)
|
||||
if (candConsumed > desired + allowedError) {
|
||||
const valueToReturn = Option.isNone(current_1) ? Option.some(headValue) : current_1;
|
||||
return {
|
||||
quantile: quantile_1,
|
||||
value: valueToReturn,
|
||||
consumed: consumed_1,
|
||||
rest: rest_1
|
||||
};
|
||||
}
|
||||
// If we are in the target interval, select the current head and hand back the leftover after dropping all elements
|
||||
// from the sample chunk that are equal to the current head
|
||||
switch (current_1._tag) {
|
||||
case "None":
|
||||
{
|
||||
error_2 = error_1;
|
||||
sampleCount_2 = sampleCount_1;
|
||||
current_2 = Arr.head(rest_1);
|
||||
consumed_2 = candConsumed;
|
||||
quantile_2 = quantile_1;
|
||||
rest_2 = sameHead[1];
|
||||
error_1 = error_2;
|
||||
sampleCount_1 = sampleCount_2;
|
||||
current_1 = current_2;
|
||||
consumed_1 = consumed_2;
|
||||
quantile_1 = quantile_2;
|
||||
rest_1 = rest_2;
|
||||
continue;
|
||||
}
|
||||
case "Some":
|
||||
{
|
||||
const prevError = Math.abs(desired - current_1.value);
|
||||
if (candError < prevError) {
|
||||
error_2 = error_1;
|
||||
sampleCount_2 = sampleCount_1;
|
||||
current_2 = Arr.head(rest_1);
|
||||
consumed_2 = candConsumed;
|
||||
quantile_2 = quantile_1;
|
||||
rest_2 = sameHead[1];
|
||||
error_1 = error_2;
|
||||
sampleCount_1 = sampleCount_2;
|
||||
current_1 = current_2;
|
||||
consumed_1 = consumed_2;
|
||||
quantile_1 = quantile_2;
|
||||
rest_1 = rest_2;
|
||||
continue;
|
||||
}
|
||||
return {
|
||||
quantile: quantile_1,
|
||||
value: Option.some(current_1.value),
|
||||
consumed: consumed_1,
|
||||
rest: rest_1
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
};
|
||||
//# sourceMappingURL=hook.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/hook.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/hook.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
73
_node_modules/effect/dist/cjs/internal/metric/key.js
generated
vendored
Normal file
73
_node_modules/effect/dist/cjs/internal/metric/key.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.taggedWithLabels = exports.tagged = exports.summary = exports.isMetricKey = exports.histogram = exports.gauge = exports.frequency = exports.counter = exports.MetricKeyTypeId = void 0;
|
||||
var Arr = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
var metricKeyType = _interopRequireWildcard(require("./keyType.js"));
|
||||
var metricLabel = _interopRequireWildcard(require("./label.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricKeySymbolKey = "effect/MetricKey";
|
||||
/** @internal */
|
||||
const MetricKeyTypeId = exports.MetricKeyTypeId = /*#__PURE__*/Symbol.for(MetricKeySymbolKey);
|
||||
const metricKeyVariance = {
|
||||
/* c8 ignore next */
|
||||
_Type: _ => _
|
||||
};
|
||||
const arrayEquivilence = /*#__PURE__*/Arr.getEquivalence(Equal.equals);
|
||||
/** @internal */
|
||||
class MetricKeyImpl {
|
||||
name;
|
||||
keyType;
|
||||
description;
|
||||
tags;
|
||||
[MetricKeyTypeId] = metricKeyVariance;
|
||||
constructor(name, keyType, description, tags = []) {
|
||||
this.name = name;
|
||||
this.keyType = keyType;
|
||||
this.description = description;
|
||||
this.tags = tags;
|
||||
this._hash = (0, _Function.pipe)(Hash.string(this.name + this.description), Hash.combine(Hash.hash(this.keyType)), Hash.combine(Hash.array(this.tags)));
|
||||
}
|
||||
_hash;
|
||||
[Hash.symbol]() {
|
||||
return this._hash;
|
||||
}
|
||||
[Equal.symbol](u) {
|
||||
return isMetricKey(u) && this.name === u.name && Equal.equals(this.keyType, u.keyType) && Equal.equals(this.description, u.description) && arrayEquivilence(this.tags, u.tags);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const isMetricKey = u => (0, _Predicate.hasProperty)(u, MetricKeyTypeId);
|
||||
/** @internal */
|
||||
exports.isMetricKey = isMetricKey;
|
||||
const counter = (name, options) => new MetricKeyImpl(name, metricKeyType.counter(options), Option.fromNullable(options?.description));
|
||||
/** @internal */
|
||||
exports.counter = counter;
|
||||
const frequency = (name, options) => new MetricKeyImpl(name, metricKeyType.frequency(options), Option.fromNullable(options?.description));
|
||||
/** @internal */
|
||||
exports.frequency = frequency;
|
||||
const gauge = (name, options) => new MetricKeyImpl(name, metricKeyType.gauge(options), Option.fromNullable(options?.description));
|
||||
/** @internal */
|
||||
exports.gauge = gauge;
|
||||
const histogram = (name, boundaries, description) => new MetricKeyImpl(name, metricKeyType.histogram(boundaries), Option.fromNullable(description));
|
||||
/** @internal */
|
||||
exports.histogram = histogram;
|
||||
const summary = options => new MetricKeyImpl(options.name, metricKeyType.summary(options), Option.fromNullable(options.description));
|
||||
/** @internal */
|
||||
exports.summary = summary;
|
||||
const tagged = exports.tagged = /*#__PURE__*/(0, _Function.dual)(3, (self, key, value) => taggedWithLabels(self, [metricLabel.make(key, value)]));
|
||||
/** @internal */
|
||||
const taggedWithLabels = exports.taggedWithLabels = /*#__PURE__*/(0, _Function.dual)(2, (self, extraTags) => extraTags.length === 0 ? self : new MetricKeyImpl(self.name, self.keyType, self.description, Arr.union(self.tags, extraTags)));
|
||||
//# sourceMappingURL=key.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/key.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/key.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
188
_node_modules/effect/dist/cjs/internal/metric/keyType.js
generated
vendored
Normal file
188
_node_modules/effect/dist/cjs/internal/metric/keyType.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.summary = exports.isSummaryKey = exports.isMetricKeyType = exports.isHistogramKey = exports.isGaugeKey = exports.isFrequencyKey = exports.isCounterKey = exports.histogram = exports.gauge = exports.frequency = exports.counter = exports.SummaryKeyTypeTypeId = exports.MetricKeyTypeTypeId = exports.HistogramKeyTypeTypeId = exports.HistogramKeyType = exports.GaugeKeyTypeTypeId = exports.FrequencyKeyTypeTypeId = exports.CounterKeyTypeTypeId = void 0;
|
||||
var Duration = _interopRequireWildcard(require("../../Duration.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricKeyTypeSymbolKey = "effect/MetricKeyType";
|
||||
/** @internal */
|
||||
const MetricKeyTypeTypeId = exports.MetricKeyTypeTypeId = /*#__PURE__*/Symbol.for(MetricKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
const CounterKeyTypeSymbolKey = "effect/MetricKeyType/Counter";
|
||||
/** @internal */
|
||||
const CounterKeyTypeTypeId = exports.CounterKeyTypeTypeId = /*#__PURE__*/Symbol.for(CounterKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
const FrequencyKeyTypeSymbolKey = "effect/MetricKeyType/Frequency";
|
||||
/** @internal */
|
||||
const FrequencyKeyTypeTypeId = exports.FrequencyKeyTypeTypeId = /*#__PURE__*/Symbol.for(FrequencyKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
const GaugeKeyTypeSymbolKey = "effect/MetricKeyType/Gauge";
|
||||
/** @internal */
|
||||
const GaugeKeyTypeTypeId = exports.GaugeKeyTypeTypeId = /*#__PURE__*/Symbol.for(GaugeKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
const HistogramKeyTypeSymbolKey = "effect/MetricKeyType/Histogram";
|
||||
/** @internal */
|
||||
const HistogramKeyTypeTypeId = exports.HistogramKeyTypeTypeId = /*#__PURE__*/Symbol.for(HistogramKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
const SummaryKeyTypeSymbolKey = "effect/MetricKeyType/Summary";
|
||||
/** @internal */
|
||||
const SummaryKeyTypeTypeId = exports.SummaryKeyTypeTypeId = /*#__PURE__*/Symbol.for(SummaryKeyTypeSymbolKey);
|
||||
const metricKeyTypeVariance = {
|
||||
/* c8 ignore next */
|
||||
_In: _ => _,
|
||||
/* c8 ignore next */
|
||||
_Out: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class CounterKeyType {
|
||||
incremental;
|
||||
bigint;
|
||||
[MetricKeyTypeTypeId] = metricKeyTypeVariance;
|
||||
[CounterKeyTypeTypeId] = CounterKeyTypeTypeId;
|
||||
constructor(incremental, bigint) {
|
||||
this.incremental = incremental;
|
||||
this.bigint = bigint;
|
||||
this._hash = Hash.string(CounterKeyTypeSymbolKey);
|
||||
}
|
||||
_hash;
|
||||
[Hash.symbol]() {
|
||||
return this._hash;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isCounterKey(that);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
const FrequencyKeyTypeHash = /*#__PURE__*/Hash.string(FrequencyKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
class FrequencyKeyType {
|
||||
preregisteredWords;
|
||||
[MetricKeyTypeTypeId] = metricKeyTypeVariance;
|
||||
[FrequencyKeyTypeTypeId] = FrequencyKeyTypeTypeId;
|
||||
constructor(preregisteredWords) {
|
||||
this.preregisteredWords = preregisteredWords;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return FrequencyKeyTypeHash;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isFrequencyKey(that);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
const GaugeKeyTypeHash = /*#__PURE__*/Hash.string(GaugeKeyTypeSymbolKey);
|
||||
/** @internal */
|
||||
class GaugeKeyType {
|
||||
bigint;
|
||||
[MetricKeyTypeTypeId] = metricKeyTypeVariance;
|
||||
[GaugeKeyTypeTypeId] = GaugeKeyTypeTypeId;
|
||||
constructor(bigint) {
|
||||
this.bigint = bigint;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return GaugeKeyTypeHash;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isGaugeKey(that);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
class HistogramKeyType {
|
||||
boundaries;
|
||||
[MetricKeyTypeTypeId] = metricKeyTypeVariance;
|
||||
[HistogramKeyTypeTypeId] = HistogramKeyTypeTypeId;
|
||||
constructor(boundaries) {
|
||||
this.boundaries = boundaries;
|
||||
this._hash = (0, _Function.pipe)(Hash.string(HistogramKeyTypeSymbolKey), Hash.combine(Hash.hash(this.boundaries)));
|
||||
}
|
||||
_hash;
|
||||
[Hash.symbol]() {
|
||||
return this._hash;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isHistogramKey(that) && Equal.equals(this.boundaries, that.boundaries);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.HistogramKeyType = HistogramKeyType;
|
||||
class SummaryKeyType {
|
||||
maxAge;
|
||||
maxSize;
|
||||
error;
|
||||
quantiles;
|
||||
[MetricKeyTypeTypeId] = metricKeyTypeVariance;
|
||||
[SummaryKeyTypeTypeId] = SummaryKeyTypeTypeId;
|
||||
constructor(maxAge, maxSize, error, quantiles) {
|
||||
this.maxAge = maxAge;
|
||||
this.maxSize = maxSize;
|
||||
this.error = error;
|
||||
this.quantiles = quantiles;
|
||||
this._hash = (0, _Function.pipe)(Hash.string(SummaryKeyTypeSymbolKey), Hash.combine(Hash.hash(this.maxAge)), Hash.combine(Hash.hash(this.maxSize)), Hash.combine(Hash.hash(this.error)), Hash.combine(Hash.array(this.quantiles)));
|
||||
}
|
||||
_hash;
|
||||
[Hash.symbol]() {
|
||||
return this._hash;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isSummaryKey(that) && Equal.equals(this.maxAge, that.maxAge) && this.maxSize === that.maxSize && this.error === that.error && Equal.equals(this.quantiles, that.quantiles);
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const counter = options => new CounterKeyType(options?.incremental ?? false, options?.bigint ?? false);
|
||||
/** @internal */
|
||||
exports.counter = counter;
|
||||
const frequency = options => new FrequencyKeyType(options?.preregisteredWords ?? []);
|
||||
/** @internal */
|
||||
exports.frequency = frequency;
|
||||
const gauge = options => new GaugeKeyType(options?.bigint ?? false);
|
||||
/** @internal */
|
||||
exports.gauge = gauge;
|
||||
const histogram = boundaries => {
|
||||
return new HistogramKeyType(boundaries);
|
||||
};
|
||||
/** @internal */
|
||||
exports.histogram = histogram;
|
||||
const summary = options => {
|
||||
return new SummaryKeyType(Duration.decode(options.maxAge), options.maxSize, options.error, options.quantiles);
|
||||
};
|
||||
/** @internal */
|
||||
exports.summary = summary;
|
||||
const isMetricKeyType = u => (0, _Predicate.hasProperty)(u, MetricKeyTypeTypeId);
|
||||
/** @internal */
|
||||
exports.isMetricKeyType = isMetricKeyType;
|
||||
const isCounterKey = u => (0, _Predicate.hasProperty)(u, CounterKeyTypeTypeId);
|
||||
/** @internal */
|
||||
exports.isCounterKey = isCounterKey;
|
||||
const isFrequencyKey = u => (0, _Predicate.hasProperty)(u, FrequencyKeyTypeTypeId);
|
||||
/** @internal */
|
||||
exports.isFrequencyKey = isFrequencyKey;
|
||||
const isGaugeKey = u => (0, _Predicate.hasProperty)(u, GaugeKeyTypeTypeId);
|
||||
/** @internal */
|
||||
exports.isGaugeKey = isGaugeKey;
|
||||
const isHistogramKey = u => (0, _Predicate.hasProperty)(u, HistogramKeyTypeTypeId);
|
||||
/** @internal */
|
||||
exports.isHistogramKey = isHistogramKey;
|
||||
const isSummaryKey = u => (0, _Predicate.hasProperty)(u, SummaryKeyTypeTypeId);
|
||||
exports.isSummaryKey = isSummaryKey;
|
||||
//# sourceMappingURL=keyType.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/keyType.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/keyType.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
_node_modules/effect/dist/cjs/internal/metric/label.js
generated
vendored
Normal file
45
_node_modules/effect/dist/cjs/internal/metric/label.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.make = exports.isMetricLabel = exports.MetricLabelTypeId = void 0;
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricLabelSymbolKey = "effect/MetricLabel";
|
||||
/** @internal */
|
||||
const MetricLabelTypeId = exports.MetricLabelTypeId = /*#__PURE__*/Symbol.for(MetricLabelSymbolKey);
|
||||
/** @internal */
|
||||
class MetricLabelImpl {
|
||||
key;
|
||||
value;
|
||||
[MetricLabelTypeId] = MetricLabelTypeId;
|
||||
_hash;
|
||||
constructor(key, value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this._hash = Hash.string(MetricLabelSymbolKey + this.key + this.value);
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return this._hash;
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isMetricLabel(that) && this.key === that.key && this.value === that.value;
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const make = (key, value) => {
|
||||
return new MetricLabelImpl(key, value);
|
||||
};
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const isMetricLabel = u => (0, _Predicate.hasProperty)(u, MetricLabelTypeId);
|
||||
exports.isMetricLabel = isMetricLabel;
|
||||
//# sourceMappingURL=label.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/label.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/label.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"label.js","names":["Equal","_interopRequireWildcard","require","Hash","_Pipeable","_Predicate","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MetricLabelSymbolKey","MetricLabelTypeId","exports","Symbol","for","MetricLabelImpl","key","value","_hash","constructor","string","symbol","that","isMetricLabel","pipe","pip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jD;AACO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,gBAAkCE,MAAM,CAACC,GAAG,CACxEJ,oBAAoB,CACY;AAElC;AACA,MAAMK,eAAe;EAGEC,GAAA;EAAsBC,KAAA;EAFlC,CAACN,iBAAiB,IAAmCA,iBAAiB;EACtEO,KAAK;EACdC,YAAqBH,GAAW,EAAWC,KAAa;IAAnC,KAAAD,GAAG,GAAHA,GAAG;IAAmB,KAAAC,KAAK,GAALA,KAAK;IAC9C,IAAI,CAACC,KAAK,GAAG9B,IAAI,CAACgC,MAAM,CAACV,oBAAoB,GAAG,IAAI,CAACM,GAAG,GAAG,IAAI,CAACC,KAAK,CAAC;EACxE;EACA,CAAC7B,IAAI,CAACiC,MAAM,IAAC;IACX,OAAO,IAAI,CAACH,KAAK;EACnB;EACA,CAACjC,KAAK,CAACoC,MAAM,EAAEC,IAAa;IAC1B,OAAOC,aAAa,CAACD,IAAI,CAAC,IACxB,IAAI,CAACN,GAAG,KAAKM,IAAI,CAACN,GAAG,IACrB,IAAI,CAACC,KAAK,KAAKK,IAAI,CAACL,KAAK;EAC7B;EACAO,IAAIA,CAAA;IACF,OAAO,IAAAC,uBAAa,EAAC,IAAI,EAAEC,SAAS,CAAC;EACvC;;AAGF;AACO,MAAMC,IAAI,GAAGA,CAACX,GAAW,EAAEC,KAAa,KAA6B;EAC1E,OAAO,IAAIF,eAAe,CAACC,GAAG,EAAEC,KAAK,CAAC;AACxC,CAAC;AAED;AAAAL,OAAA,CAAAe,IAAA,GAAAA,IAAA;AACO,MAAMJ,aAAa,GAAIK,CAAU,IAAmC,IAAAC,sBAAW,EAACD,CAAC,EAAEjB,iBAAiB,CAAC;AAAAC,OAAA,CAAAW,aAAA,GAAAA,aAAA","ignoreList":[]}
|
||||
40
_node_modules/effect/dist/cjs/internal/metric/pair.js
generated
vendored
Normal file
40
_node_modules/effect/dist/cjs/internal/metric/pair.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.unsafeMake = exports.make = exports.MetricPairTypeId = void 0;
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
/** @internal */
|
||||
const MetricPairSymbolKey = "effect/MetricPair";
|
||||
/** @internal */
|
||||
const MetricPairTypeId = exports.MetricPairTypeId = /*#__PURE__*/Symbol.for(MetricPairSymbolKey);
|
||||
const metricPairVariance = {
|
||||
/* c8 ignore next */
|
||||
_Type: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const make = (metricKey, metricState) => {
|
||||
return {
|
||||
[MetricPairTypeId]: metricPairVariance,
|
||||
metricKey,
|
||||
metricState,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
};
|
||||
};
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const unsafeMake = (metricKey, metricState) => {
|
||||
return {
|
||||
[MetricPairTypeId]: metricPairVariance,
|
||||
metricKey,
|
||||
metricState,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.unsafeMake = unsafeMake;
|
||||
//# sourceMappingURL=pair.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/pair.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/pair.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pair.js","names":["_Pipeable","require","MetricPairSymbolKey","MetricPairTypeId","exports","Symbol","for","metricPairVariance","_Type","_","make","metricKey","metricState","pipe","pipeArguments","arguments","unsafeMake"],"sources":["../../../../src/internal/metric/pair.ts"],"sourcesContent":[null],"mappings":";;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA,MAAMC,mBAAmB,GAAG,mBAAmB;AAE/C;AACO,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,gBAAgCE,MAAM,CAACC,GAAG,CACrEJ,mBAAmB,CACW;AAEhC,MAAMK,kBAAkB,GAAG;EACzB;EACAC,KAAK,EAAGC,CAAQ,IAAKA;CACtB;AAED;AACO,MAAMC,IAAI,GAAGA,CAClBC,SAAoC,EACpCC,WAA+E,KAC9C;EACjC,OAAO;IACL,CAACT,gBAAgB,GAAGI,kBAAkB;IACtCI,SAAS;IACTC,WAAW;IACXC,IAAIA,CAAA;MACF,OAAO,IAAAC,uBAAa,EAAC,IAAI,EAAEC,SAAS,CAAC;IACvC;GACD;AACH,CAAC;AAED;AAAAX,OAAA,CAAAM,IAAA,GAAAA,IAAA;AACO,MAAMM,UAAU,GAAGA,CACxBL,SAAoC,EACpCC,WAA4C,KACX;EACjC,OAAO;IACL,CAACT,gBAAgB,GAAGI,kBAAkB;IACtCI,SAAS;IACTC,WAAW;IACXC,IAAIA,CAAA;MACF,OAAO,IAAAC,uBAAa,EAAC,IAAI,EAAEC,SAAS,CAAC;IACvC;GACD;AACH,CAAC;AAAAX,OAAA,CAAAY,UAAA,GAAAA,UAAA","ignoreList":[]}
|
||||
80
_node_modules/effect/dist/cjs/internal/metric/polling.js
generated
vendored
Normal file
80
_node_modules/effect/dist/cjs/internal/metric/polling.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.zip = exports.retry = exports.pollAndUpdate = exports.poll = exports.make = exports.launch = exports.collectAll = exports.MetricPollingTypeId = void 0;
|
||||
var _Function = require("../../Function.js");
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var core = _interopRequireWildcard(require("../core.js"));
|
||||
var metric = _interopRequireWildcard(require("../metric.js"));
|
||||
var schedule_ = _interopRequireWildcard(require("../schedule.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricPollingSymbolKey = "effect/MetricPolling";
|
||||
/** @internal */
|
||||
const MetricPollingTypeId = exports.MetricPollingTypeId = /*#__PURE__*/Symbol.for(MetricPollingSymbolKey);
|
||||
/** @internal */
|
||||
const make = (metric, poll) => {
|
||||
return {
|
||||
[MetricPollingTypeId]: MetricPollingTypeId,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
metric,
|
||||
poll
|
||||
};
|
||||
};
|
||||
/** @internal */
|
||||
exports.make = make;
|
||||
const collectAll = iterable => {
|
||||
const metrics = Array.from(iterable);
|
||||
return {
|
||||
[MetricPollingTypeId]: MetricPollingTypeId,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
metric: metric.make(Array.of(void 0), (inputs, extraTags) => {
|
||||
for (let i = 0; i < inputs.length; i++) {
|
||||
const pollingMetric = metrics[i];
|
||||
const input = (0, _Function.pipe)(inputs, x => x[i]);
|
||||
pollingMetric.metric.unsafeUpdate(input, extraTags);
|
||||
}
|
||||
}, extraTags => Array.from(metrics.map(pollingMetric => pollingMetric.metric.unsafeValue(extraTags))), (inputs, extraTags) => {
|
||||
for (let i = 0; i < inputs.length; i++) {
|
||||
const pollingMetric = metrics[i];
|
||||
const input = (0, _Function.pipe)(inputs, x => x[i]);
|
||||
pollingMetric.metric.unsafeModify(input, extraTags);
|
||||
}
|
||||
}),
|
||||
poll: core.forEachSequential(metrics, metric => metric.poll)
|
||||
};
|
||||
};
|
||||
/** @internal */
|
||||
exports.collectAll = collectAll;
|
||||
const launch = exports.launch = /*#__PURE__*/(0, _Function.dual)(2, (self, schedule) => (0, _Function.pipe)(pollAndUpdate(self), core.zipRight(metric.value(self.metric)), schedule_.scheduleForked(schedule)));
|
||||
/** @internal */
|
||||
const poll = self => self.poll;
|
||||
/** @internal */
|
||||
exports.poll = poll;
|
||||
const pollAndUpdate = self => core.flatMap(self.poll, value => metric.update(self.metric, value));
|
||||
/** @internal */
|
||||
exports.pollAndUpdate = pollAndUpdate;
|
||||
const retry = exports.retry = /*#__PURE__*/(0, _Function.dual)(2, (self, policy) => ({
|
||||
[MetricPollingTypeId]: MetricPollingTypeId,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
metric: self.metric,
|
||||
poll: schedule_.retry_Effect(self.poll, policy)
|
||||
}));
|
||||
/** @internal */
|
||||
const zip = exports.zip = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => ({
|
||||
[MetricPollingTypeId]: MetricPollingTypeId,
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
},
|
||||
metric: (0, _Function.pipe)(self.metric, metric.zip(that.metric)),
|
||||
poll: core.zip(self.poll, that.poll)
|
||||
}));
|
||||
//# sourceMappingURL=polling.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/polling.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/polling.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polling.js","names":["_Function","require","_Pipeable","core","_interopRequireWildcard","metric","schedule_","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MetricPollingSymbolKey","MetricPollingTypeId","exports","Symbol","for","make","poll","pipe","pipeArguments","arguments","collectAll","iterable","metrics","Array","from","of","inputs","extraTags","length","pollingMetric","input","x","unsafeUpdate","map","unsafeValue","unsafeModify","forEachSequential","launch","dual","self","schedule","pollAndUpdate","zipRight","value","scheduleForked","flatMap","update","retry","policy","retry_Effect","zip","that"],"sources":["../../../../src/internal/metric/polling.ts"],"sourcesContent":[null],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AAGA,IAAAE,IAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,uBAAA,CAAAH,OAAA;AACA,IAAAK,SAAA,GAAAF,uBAAA,CAAAH,OAAA;AAA2C,SAAAG,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,C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AAM,CAACP,IAAI,CAAClD,MAAM,EAAEsD,KAAK,CAAC,CAAC;AAErG;AAAA/B,OAAA,CAAA6B,aAAA,GAAAA,aAAA;AACO,MAAMM,KAAK,GAAAnC,OAAA,CAAAmC,KAAA,gBAAG,IAAAT,cAAI,EAUvB,CAAC,EAAE,CAACC,IAAI,EAAES,MAAM,MAAM;EACtB,CAACrC,mBAAmB,GAAGA,mBAAmB;EAC1CM,IAAIA,CAAA;IACF,OAAO,IAAAC,uBAAa,EAAC,IAAI,EAAEC,SAAS,CAAC;EACvC,CAAC;EACD9B,MAAM,EAAEkD,IAAI,CAAClD,MAAM;EACnB2B,IAAI,EAAE1B,SAAS,CAAC2D,YAAY,CAACV,IAAI,CAACvB,IAAI,EAAEgC,MAAM;CAC/C,CAAC,CAAC;AAEH;AACO,MAAME,GAAG,GAAAtC,OAAA,CAAAsC,GAAA,gBAAG,IAAAZ,cAAI,EAsBrB,CAAC,EAAE,CAACC,IAAI,EAAEY,IAAI,MAAM;EACpB,CAACxC,mBAAmB,GAAGA,mBAAmB;EAC1CM,IAAIA,CAAA;IACF,OAAO,IAAAC,uBAAa,EAAC,IAAI,EAAEC,SAAS,CAAC;EACvC,CAAC;EACD9B,MAAM,EAAE,IAAA4B,cAAI,EAACsB,IAAI,CAAClD,MAAM,EAAEA,MAAM,CAAC6D,GAAG,CAACC,IAAI,CAAC9D,MAAM,CAAC,CAAC;EAClD2B,IAAI,EAAE7B,IAAI,CAAC+D,GAAG,CAACX,IAAI,CAACvB,IAAI,EAAEmC,IAAI,CAACnC,IAAI;CACpC,CAAC,CAAC","ignoreList":[]}
|
||||
113
_node_modules/effect/dist/cjs/internal/metric/registry.js
generated
vendored
Normal file
113
_node_modules/effect/dist/cjs/internal/metric/registry.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.make = exports.MetricRegistryTypeId = void 0;
|
||||
var _Function = require("../../Function.js");
|
||||
var MutableHashMap = _interopRequireWildcard(require("../../MutableHashMap.js"));
|
||||
var Option = _interopRequireWildcard(require("../../Option.js"));
|
||||
var metricHook = _interopRequireWildcard(require("./hook.js"));
|
||||
var metricKeyType = _interopRequireWildcard(require("./keyType.js"));
|
||||
var metricPair = _interopRequireWildcard(require("./pair.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricRegistrySymbolKey = "effect/MetricRegistry";
|
||||
/** @internal */
|
||||
const MetricRegistryTypeId = exports.MetricRegistryTypeId = /*#__PURE__*/Symbol.for(MetricRegistrySymbolKey);
|
||||
/** @internal */
|
||||
class MetricRegistryImpl {
|
||||
[MetricRegistryTypeId] = MetricRegistryTypeId;
|
||||
map = /*#__PURE__*/MutableHashMap.empty();
|
||||
snapshot() {
|
||||
const result = [];
|
||||
for (const [key, hook] of this.map) {
|
||||
result.push(metricPair.unsafeMake(key, hook.get()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
get(key) {
|
||||
const hook = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined);
|
||||
if (hook == null) {
|
||||
if (metricKeyType.isCounterKey(key.keyType)) {
|
||||
return this.getCounter(key);
|
||||
}
|
||||
if (metricKeyType.isGaugeKey(key.keyType)) {
|
||||
return this.getGauge(key);
|
||||
}
|
||||
if (metricKeyType.isFrequencyKey(key.keyType)) {
|
||||
return this.getFrequency(key);
|
||||
}
|
||||
if (metricKeyType.isHistogramKey(key.keyType)) {
|
||||
return this.getHistogram(key);
|
||||
}
|
||||
if (metricKeyType.isSummaryKey(key.keyType)) {
|
||||
return this.getSummary(key);
|
||||
}
|
||||
throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
} else {
|
||||
return hook;
|
||||
}
|
||||
}
|
||||
getCounter(key) {
|
||||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined);
|
||||
if (value == null) {
|
||||
const counter = metricHook.counter(key);
|
||||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) {
|
||||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, counter));
|
||||
}
|
||||
value = counter;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
getFrequency(key) {
|
||||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined);
|
||||
if (value == null) {
|
||||
const frequency = metricHook.frequency(key);
|
||||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) {
|
||||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, frequency));
|
||||
}
|
||||
value = frequency;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
getGauge(key) {
|
||||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined);
|
||||
if (value == null) {
|
||||
const gauge = metricHook.gauge(key, key.keyType.bigint ? BigInt(0) : 0);
|
||||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) {
|
||||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, gauge));
|
||||
}
|
||||
value = gauge;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
getHistogram(key) {
|
||||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined);
|
||||
if (value == null) {
|
||||
const histogram = metricHook.histogram(key);
|
||||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) {
|
||||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, histogram));
|
||||
}
|
||||
value = histogram;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
getSummary(key) {
|
||||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined);
|
||||
if (value == null) {
|
||||
const summary = metricHook.summary(key);
|
||||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) {
|
||||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, summary));
|
||||
}
|
||||
value = summary;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
const make = () => {
|
||||
return new MetricRegistryImpl();
|
||||
};
|
||||
exports.make = make;
|
||||
//# sourceMappingURL=registry.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/registry.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/registry.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
201
_node_modules/effect/dist/cjs/internal/metric/state.js
generated
vendored
Normal file
201
_node_modules/effect/dist/cjs/internal/metric/state.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.summary = exports.isSummaryState = exports.isMetricState = exports.isHistogramState = exports.isGaugeState = exports.isFrequencyState = exports.isCounterState = exports.histogram = exports.gauge = exports.frequency = exports.counter = exports.SummaryStateTypeId = exports.SummaryState = exports.MetricStateTypeId = exports.HistogramStateTypeId = exports.HistogramState = exports.GaugeStateTypeId = exports.FrequencyStateTypeId = exports.CounterStateTypeId = void 0;
|
||||
var Arr = _interopRequireWildcard(require("../../Array.js"));
|
||||
var Equal = _interopRequireWildcard(require("../../Equal.js"));
|
||||
var _Function = require("../../Function.js");
|
||||
var Hash = _interopRequireWildcard(require("../../Hash.js"));
|
||||
var _Pipeable = require("../../Pipeable.js");
|
||||
var _Predicate = require("../../Predicate.js");
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/** @internal */
|
||||
const MetricStateSymbolKey = "effect/MetricState";
|
||||
/** @internal */
|
||||
const MetricStateTypeId = exports.MetricStateTypeId = /*#__PURE__*/Symbol.for(MetricStateSymbolKey);
|
||||
/** @internal */
|
||||
const CounterStateSymbolKey = "effect/MetricState/Counter";
|
||||
/** @internal */
|
||||
const CounterStateTypeId = exports.CounterStateTypeId = /*#__PURE__*/Symbol.for(CounterStateSymbolKey);
|
||||
/** @internal */
|
||||
const FrequencyStateSymbolKey = "effect/MetricState/Frequency";
|
||||
/** @internal */
|
||||
const FrequencyStateTypeId = exports.FrequencyStateTypeId = /*#__PURE__*/Symbol.for(FrequencyStateSymbolKey);
|
||||
/** @internal */
|
||||
const GaugeStateSymbolKey = "effect/MetricState/Gauge";
|
||||
/** @internal */
|
||||
const GaugeStateTypeId = exports.GaugeStateTypeId = /*#__PURE__*/Symbol.for(GaugeStateSymbolKey);
|
||||
/** @internal */
|
||||
const HistogramStateSymbolKey = "effect/MetricState/Histogram";
|
||||
/** @internal */
|
||||
const HistogramStateTypeId = exports.HistogramStateTypeId = /*#__PURE__*/Symbol.for(HistogramStateSymbolKey);
|
||||
/** @internal */
|
||||
const SummaryStateSymbolKey = "effect/MetricState/Summary";
|
||||
/** @internal */
|
||||
const SummaryStateTypeId = exports.SummaryStateTypeId = /*#__PURE__*/Symbol.for(SummaryStateSymbolKey);
|
||||
const metricStateVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
class CounterState {
|
||||
count;
|
||||
[MetricStateTypeId] = metricStateVariance;
|
||||
[CounterStateTypeId] = CounterStateTypeId;
|
||||
constructor(count) {
|
||||
this.count = count;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(CounterStateSymbolKey), Hash.combine(Hash.hash(this.count)), Hash.cached(this));
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isCounterState(that) && this.count === that.count;
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
const arrayEquals = /*#__PURE__*/Arr.getEquivalence(Equal.equals);
|
||||
/** @internal */
|
||||
class FrequencyState {
|
||||
occurrences;
|
||||
[MetricStateTypeId] = metricStateVariance;
|
||||
[FrequencyStateTypeId] = FrequencyStateTypeId;
|
||||
constructor(occurrences) {
|
||||
this.occurrences = occurrences;
|
||||
}
|
||||
_hash;
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.string(FrequencyStateSymbolKey), Hash.combine(Hash.array(Arr.fromIterable(this.occurrences.entries()))), Hash.cached(this));
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isFrequencyState(that) && arrayEquals(Arr.fromIterable(this.occurrences.entries()), Arr.fromIterable(that.occurrences.entries()));
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
class GaugeState {
|
||||
value;
|
||||
[MetricStateTypeId] = metricStateVariance;
|
||||
[GaugeStateTypeId] = GaugeStateTypeId;
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(GaugeStateSymbolKey), Hash.combine(Hash.hash(this.value)), Hash.cached(this));
|
||||
}
|
||||
[Equal.symbol](u) {
|
||||
return isGaugeState(u) && this.value === u.value;
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
class HistogramState {
|
||||
buckets;
|
||||
count;
|
||||
min;
|
||||
max;
|
||||
sum;
|
||||
[MetricStateTypeId] = metricStateVariance;
|
||||
[HistogramStateTypeId] = HistogramStateTypeId;
|
||||
constructor(buckets, count, min, max, sum) {
|
||||
this.buckets = buckets;
|
||||
this.count = count;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.sum = sum;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(HistogramStateSymbolKey), Hash.combine(Hash.hash(this.buckets)), Hash.combine(Hash.hash(this.count)), Hash.combine(Hash.hash(this.min)), Hash.combine(Hash.hash(this.max)), Hash.combine(Hash.hash(this.sum)), Hash.cached(this));
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isHistogramState(that) && Equal.equals(this.buckets, that.buckets) && this.count === that.count && this.min === that.min && this.max === that.max && this.sum === that.sum;
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.HistogramState = HistogramState;
|
||||
class SummaryState {
|
||||
error;
|
||||
quantiles;
|
||||
count;
|
||||
min;
|
||||
max;
|
||||
sum;
|
||||
[MetricStateTypeId] = metricStateVariance;
|
||||
[SummaryStateTypeId] = SummaryStateTypeId;
|
||||
constructor(error, quantiles, count, min, max, sum) {
|
||||
this.error = error;
|
||||
this.quantiles = quantiles;
|
||||
this.count = count;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.sum = sum;
|
||||
}
|
||||
[Hash.symbol]() {
|
||||
return (0, _Function.pipe)(Hash.hash(SummaryStateSymbolKey), Hash.combine(Hash.hash(this.error)), Hash.combine(Hash.hash(this.quantiles)), Hash.combine(Hash.hash(this.count)), Hash.combine(Hash.hash(this.min)), Hash.combine(Hash.hash(this.max)), Hash.combine(Hash.hash(this.sum)), Hash.cached(this));
|
||||
}
|
||||
[Equal.symbol](that) {
|
||||
return isSummaryState(that) && this.error === that.error && Equal.equals(this.quantiles, that.quantiles) && this.count === that.count && this.min === that.min && this.max === that.max && this.sum === that.sum;
|
||||
}
|
||||
pipe() {
|
||||
return (0, _Pipeable.pipeArguments)(this, arguments);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
exports.SummaryState = SummaryState;
|
||||
const counter = count => new CounterState(count);
|
||||
/** @internal */
|
||||
exports.counter = counter;
|
||||
const frequency = occurrences => {
|
||||
return new FrequencyState(occurrences);
|
||||
};
|
||||
/** @internal */
|
||||
exports.frequency = frequency;
|
||||
const gauge = count => new GaugeState(count);
|
||||
/** @internal */
|
||||
exports.gauge = gauge;
|
||||
const histogram = options => new HistogramState(options.buckets, options.count, options.min, options.max, options.sum);
|
||||
/** @internal */
|
||||
exports.histogram = histogram;
|
||||
const summary = options => new SummaryState(options.error, options.quantiles, options.count, options.min, options.max, options.sum);
|
||||
/** @internal */
|
||||
exports.summary = summary;
|
||||
const isMetricState = u => (0, _Predicate.hasProperty)(u, MetricStateTypeId);
|
||||
/** @internal */
|
||||
exports.isMetricState = isMetricState;
|
||||
const isCounterState = u => (0, _Predicate.hasProperty)(u, CounterStateTypeId);
|
||||
/**
|
||||
* @since 2.0.0
|
||||
* @category refinements
|
||||
*/
|
||||
exports.isCounterState = isCounterState;
|
||||
const isFrequencyState = u => (0, _Predicate.hasProperty)(u, FrequencyStateTypeId);
|
||||
/**
|
||||
* @since 2.0.0
|
||||
* @category refinements
|
||||
*/
|
||||
exports.isFrequencyState = isFrequencyState;
|
||||
const isGaugeState = u => (0, _Predicate.hasProperty)(u, GaugeStateTypeId);
|
||||
/**
|
||||
* @since 2.0.0
|
||||
* @category refinements
|
||||
*/
|
||||
exports.isGaugeState = isGaugeState;
|
||||
const isHistogramState = u => (0, _Predicate.hasProperty)(u, HistogramStateTypeId);
|
||||
/**
|
||||
* @since 2.0.0
|
||||
* @category refinements
|
||||
*/
|
||||
exports.isHistogramState = isHistogramState;
|
||||
const isSummaryState = u => (0, _Predicate.hasProperty)(u, SummaryStateTypeId);
|
||||
exports.isSummaryState = isSummaryState;
|
||||
//# sourceMappingURL=state.js.map
|
||||
1
_node_modules/effect/dist/cjs/internal/metric/state.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/cjs/internal/metric/state.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user