container.ts
Version:
Modular application framework
73 lines • 3.07 kB
JavaScript
;
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
/** Metric types supported by StatsD. */
var EMetricType;
(function (EMetricType) {
EMetricType[EMetricType["Increment"] = 0] = "Increment";
EMetricType[EMetricType["Decrement"] = 1] = "Decrement";
EMetricType[EMetricType["Gauge"] = 2] = "Gauge";
EMetricType[EMetricType["Timing"] = 3] = "Timing";
EMetricType[EMetricType["Histogram"] = 4] = "Histogram";
})(EMetricType = exports.EMetricType || (exports.EMetricType = {}));
/** Abstract metric class. */
var Metric = /** @class */ (function () {
function Metric() {
}
/** Send increment counter metric. */
Metric.prototype.increment = function (name, value, tags) {
if (value === void 0) { value = 1; }
if (tags === void 0) { tags = {}; }
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
return this.metric.apply(this, __spreadArrays([EMetricType.Increment, name, value, tags], args));
};
/** Send decrement counter metric. */
Metric.prototype.decrement = function (name, value, tags) {
if (value === void 0) { value = -1; }
if (tags === void 0) { tags = {}; }
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
return this.metric.apply(this, __spreadArrays([EMetricType.Decrement, name, value, tags], args));
};
/** Send value metric. */
Metric.prototype.gauge = function (name, value, tags) {
if (tags === void 0) { tags = {}; }
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
return this.metric.apply(this, __spreadArrays([EMetricType.Gauge, name, value, tags], args));
};
/** Send time metric in milliseconds. */
Metric.prototype.timing = function (name, value, tags) {
if (tags === void 0) { tags = {}; }
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
return this.metric.apply(this, __spreadArrays([EMetricType.Timing, name, value, tags], args));
};
/** Send distribution value metric. */
Metric.prototype.histogram = function (name, value, tags) {
if (tags === void 0) { tags = {}; }
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
return this.metric.apply(this, __spreadArrays([EMetricType.Histogram, name, value, tags], args));
};
return Metric;
}());
exports.Metric = Metric;
//# sourceMappingURL=metric.js.map