MCPcopy Create free account
hub / github.com/Noumena-Network/code / createAttributedCounter

Function createAttributedCounter

src/entrypoints/init.ts:317–334  ·  view source on GitHub ↗
(
      name: string,
      options: MetricOptions,
    )

Source from the content-addressed store, hash-verified

315 if (meter) {
316 // Create factory function for attributed counters
317 const createAttributedCounter = (
318 name: string,
319 options: MetricOptions,
320 ): AttributedCounter => {
321 const counter = meter?.createCounter(name, options)
322
323 return {
324 add(value: number, additionalAttributes: Attributes = {}) {
325 // Always fetch fresh telemetry attributes to ensure they're up to date
326 const currentAttributes = getTelemetryAttributes()
327 const mergedAttributes = {
328 ...currentAttributes,
329 ...additionalAttributes,
330 }
331 counter?.add(value, mergedAttributes)
332 },
333 }
334 }
335
336 setMeter(meter, createAttributedCounter)
337

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected