-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Philipp Hossner <[email protected]>
- Loading branch information
Showing
7 changed files
with
276 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# The default Prometheus client data store has no means of removing values. | ||
# For the "retention" feature we need to be able to remove metrics with specific labels after some time of inactivity. | ||
# By patching the MetricStore and Metric classes we implement that missing feature. | ||
module Prometheus | ||
module Client | ||
module DataStores | ||
class Synchronized | ||
class MetricStore | ||
def remove(labels:) | ||
synchronize do | ||
@internal_store.delete(labels) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
class Metric | ||
def remove(labels) | ||
label_set = label_set_for(labels) | ||
@store.remove(labels: label_set) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.