Skip to content

Commit

Permalink
Update Metrics.java
Browse files Browse the repository at this point in the history
Added a reset for a prefix
  • Loading branch information
mchhil-incomm authored Nov 22, 2024
1 parent f257944 commit e7b0c81
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions jpos/src/main/java/org/jpos/util/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,17 @@ public void reset() {
metrics.values()
.forEach(Histogram::reset);
}

/**
* Resets histograms whose keys start with the given prefix using the Histogram.reset() method.
*
* @param prefix the prefix used to filter histograms to reset
*/
public void reset(String prefix) {
metrics.entrySet()
.stream()
.filter(e -> e.getKey().startsWith(prefix))
.forEach(e -> e.getValue().reset());
}

}

0 comments on commit e7b0c81

Please sign in to comment.