MCPcopy Create free account
hub / github.com/effect-app/libs / hook

Function hook

repos/effect/packages/effect/src/Metric.ts:1762–1779  ·  view source on GitHub ↗
(context: Context.Context<never>)

Source from the content-addressed store, hash-verified

1760 }
1761 return makeHooks(() => ({ count, incremental: this.#incremental }), update)
1762 }
1763}
1764
1765class GaugeMetric<Input extends number | bigint> extends Metric$<Input, GaugeState<Input>> {
1766 readonly type = "Gauge"
1767 readonly #bigint: boolean
1768
1769 constructor(id: string, options?: {
1770 readonly description?: string | undefined
1771 readonly attributes?: Metric.Attributes | undefined
1772 readonly bigint?: boolean | undefined
1773 }) {
1774 super(id, options?.description, attributesToRecord(options?.attributes))
1775 this.#bigint = options?.bigint ?? false
1776 }
1777
1778 createHooks(): Metric.Hooks<Input, GaugeState<Input>> {
1779 let value = this.#bigint ? BigInt(0) as any : 0
1780 const update = (input: number | bigint) => {
1781 value = input
1782 }

Callers 1

streamQuery_Function · 0.85

Calls 3

mergeAttributesFunction · 0.85
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…