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