Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export class Registry<
*/
resetMetrics(): void;

/**
* Reset one naed metric

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naed seems like a typo? perhaps:

Suggested change
* Reset one naed metric
* Reset a named metric
* @param metric Metric to reset

*/
resetMetric(name: string): void;

/**
* Register metric to register
* @param metric Metric to add to register
Expand Down
5 changes: 5 additions & 0 deletions lib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ class Registry {
this._metrics[metric].reset();
}
}
resetMetric(name) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a redundant space

Suggested change

this._metrics[name].reset();

}

get contentType() {
return this._contentType;
Expand Down