UNPKG

container.ts

Version:
46 lines 1.9 kB
"use strict"; 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 i counter metric. */ Metric.prototype.increment = function (name, value, tags) { if (value === void 0) { value = 1; } if (tags === void 0) { tags = {}; } return this.metric(EMetricType.Increment, name, value, tags); }; /** Send decrement counter metric. */ Metric.prototype.decrement = function (name, value, tags) { if (value === void 0) { value = -1; } if (tags === void 0) { tags = {}; } return this.metric(EMetricType.Decrement, name, value, tags); }; /** Send value metric. */ Metric.prototype.gauge = function (name, value, tags) { if (tags === void 0) { tags = {}; } return this.metric(EMetricType.Gauge, name, value, tags); }; /** Send time metric in milliseconds. */ Metric.prototype.timing = function (name, value, tags) { if (tags === void 0) { tags = {}; } return this.metric(EMetricType.Timing, name, value, tags); }; /** Send distribution value metric. */ Metric.prototype.histogram = function (name, value, tags) { if (tags === void 0) { tags = {}; } return this.metric(EMetricType.Histogram, name, value, tags); }; return Metric; }()); exports.Metric = Metric; //# sourceMappingURL=Metric.js.map