diff --git a/README.md b/README.md index 348a5bff..21782eb6 100644 --- a/README.md +++ b/README.md @@ -617,3 +617,7 @@ To avoid native dependencies in this module, GC statistics for bytes reclaimed in each GC sweep are kept in a separate module: https://github.com/SimenB/node-prometheus-gc-stats. (Note that that metric may no longer be accurate now that v8 uses parallel garbage collection.) + + +## Modifications +This version includes new function resetMetric(name), which allows resetting inidividual metric by name \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 1fd1eac9..0459840b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -39,6 +39,11 @@ export class Registry< */ resetMetrics(): void; + /** + * Reset one naed metric + */ + resetMetric(name: string): void; + /** * Register metric to register * @param metric Metric to add to register diff --git a/lib/registry.js b/lib/registry.js index dfe2c0b6..02077677 100644 --- a/lib/registry.js +++ b/lib/registry.js @@ -165,6 +165,11 @@ class Registry { this._metrics[metric].reset(); } } + resetMetric(name) { + + this._metrics[name].reset(); + + } get contentType() { return this._contentType;