How to use the measured-core.Timer function in measured-core

To help you get started, we’ve selected a few measured-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yaorg / node-measured / packages / measured-reporting / lib / registries / SelfReportingMetricsRegistry.js View on Github external
getOrCreateTimer(name, dimensions, publishingIntervalInSeconds) {
    validateTimerOptions(name, dimensions, publishingIntervalInSeconds);

    let timer;
    if (this._registry.hasMetric(name, dimensions)) {
      timer = this._registry.getMetric(name, dimensions);
    } else {
      timer = new Timer();
      const key = this._registry.putMetric(name, timer, dimensions);
      this._reporters.forEach(reporter => reporter.reportMetricOnInterval(key, publishingIntervalInSeconds));
    }

    return timer;
  }
github kaola-fed / console-agent / old / lib / core / metrix / timer.js View on Github external
constructor(properties = {}) {
        const { duration } = properties;

        return new Timer(Object.assign({}, properties, {
            meter: new Meter({ duration })
        }));
    }