MCPcopy Create free account
hub / github.com/Effect-TS/effect / frequency

Function frequency

packages/effect/src/internal/metric/hook.ts:102–116  ·  view source on GitHub ↗
(key: MetricKey.MetricKey.Frequency)

Source from the content-addressed store, hash-verified

100
101/** @internal */
102export const frequency = (key: MetricKey.MetricKey.Frequency): MetricHook.MetricHook.Frequency => {
103 const values = new Map<string, number>()
104 for (const word of key.keyType.preregisteredWords) {
105 values.set(word, 0)
106 }
107 const update = (word: string) => {
108 const slotCount = values.get(word) ?? 0
109 values.set(word, slotCount + 1)
110 }
111 return make({
112 get: () => metricState.frequency(values),
113 update,
114 modify: update
115 })
116}
117
118/** @internal */
119export const gauge: {

Callers

nothing calls this directly

Calls 2

makeFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected