grafana-cloud-graphite
Version:
NodeJS client for Grafana Cloud Graphite API
38 lines • 908 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphiteCounter = void 0;
class GraphiteCounter {
constructor(name, interval, tags) {
this.name = name;
this.interval = interval;
this.tags = tags;
this.count = 0;
}
get() {
return [
{
name: this.name,
interval: this.interval,
value: this.count,
time: Date.now(),
tags: this.tags,
},
];
}
clear() {
const data = this.get();
this.reset();
return data;
}
inc(value) {
if (value === 0) {
return;
}
this.count = value ? this.count + value : this.count + 1;
}
reset() {
this.count = 0;
}
}
exports.GraphiteCounter = GraphiteCounter;
//# sourceMappingURL=counter.js.map