UNPKG

vulcain-corejs

Version:
36 lines (34 loc) 1.21 kB
"use strict"; const system_1 = require("../configurations/globals/system"); /** * Metrics adapter for testing * Emit metrics on console * * @export * @class ConsoleMetrics */ class ConsoleMetrics { constructor(address) { this.tags = ",environment=" + system_1.System.environment + ",service=" + system_1.System.serviceName + ',version=' + system_1.System.serviceVersion; } log(msg) { } encodeTags(...tags) { } increment(metric, customTags, delta) { this.log(`METRICS: incr ${metric + this.tags + customTags} : ${delta || 1}`); } decrement(metric, customTags, delta) { this.log(`METRICS: decr ${metric + this.tags + customTags} : ${delta || -1}`); } counter(metric, delta, customTags) { this.log(`METRICS: counter ${metric + this.tags + customTags} : ${delta}`); } gauge(metric, value, customTags) { this.log(`METRICS: gauge ${metric + this.tags + customTags} : ${value}`); } timing(metric, duration, customTags) { this.log(`METRICS: timing ${metric + this.tags + customTags} : ${duration}ms`); } } exports.ConsoleMetrics = ConsoleMetrics; //# sourceMappingURL=consoleMetrics.js.map