Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getOrCreateGauge(name, callback, dimensions, publishingIntervalInSeconds) {
validateGaugeOptions(name, callback, dimensions, publishingIntervalInSeconds);
let gauge;
if (this._registry.hasMetric(name, dimensions)) {
gauge = this._registry.getMetric(name, dimensions);
} else {
gauge = new Gauge(callback);
const key = this._registry.putMetric(name, gauge, dimensions);
this._reporters.forEach(reporter => reporter.reportMetricOnInterval(key, publishingIntervalInSeconds));
}
return gauge;
}