UNPKG

moleculer

Version:

Fast & powerful microservices framework for Node.JS

50 lines (43 loc) 1 kB
/* * moleculer * Copyright (c) 2023 MoleculerJS (https://github.com/moleculerjs/moleculer) * MIT Licensed */ "use strict"; const GaugeMetric = require("./gauge"); const METRIC = require("../constants"); /** * Import types * * @typedef {import("../registry")} MetricRegistry * @typedef {import("./counter")} CounterMetricClass * @typedef {import("./gauge").GaugeMetricOptions} GaugeMetricOptions */ /** * Counter metric class. * * @class CounterMetric * @extends {GaugeMetric} * @implements {CounterMetricClass} */ class CounterMetric extends GaugeMetric { /** * Creates an instance of CounterMetric. * @param {GaugeMetricOptions} opts * @param {MetricRegistry} registry * @memberof CounterMetric */ constructor(opts, registry) { super(opts, registry); this.type = METRIC.TYPE_COUNTER; } /** * Disabled decrement method. * * @memberof CounterMetric */ decrement() { throw new Error("Counter can't be decreased."); } } module.exports = CounterMetric;