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

Function hook

packages/effect/src/internal/metric.ts:132–151  ·  view source on GitHub ↗
(extraTags: ReadonlyArray<MetricLabel.MetricLabel>)

Source from the content-addressed store, hash-verified

130 const hookCache = new WeakMap<ReadonlyArray<MetricLabel.MetricLabel>, MetricHook.MetricHook<any, any>>()
131
132 const hook = (extraTags: ReadonlyArray<MetricLabel.MetricLabel>): MetricHook.MetricHook<
133 MetricKeyType.MetricKeyType.InType<Type>,
134 MetricKeyType.MetricKeyType.OutType<Type>
135 > => {
136 if (extraTags.length === 0) {
137 if (untaggedHook !== undefined) {
138 return untaggedHook
139 }
140 untaggedHook = globalMetricRegistry.get(key)
141 return untaggedHook
142 }
143
144 let hook = hookCache.get(extraTags)
145 if (hook !== undefined) {
146 return hook
147 }
148 hook = globalMetricRegistry.get(metricKey.taggedWithLabels(key, extraTags))
149 hookCache.set(extraTags, hook)
150 return hook
151 }
152
153 return make(
154 key.keyType,

Callers 1

fromMetricKeyFunction · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…