Class: Fluent::Plugin::Prometheus::Metric::LastModifiedStore
- Inherits:
-
Object
- Object
- Fluent::Plugin::Prometheus::Metric::LastModifiedStore
- Defined in:
- lib/fluent/plugin/prometheus.rb
Instance Method Summary collapse
- #get_labels_not_modified_since(time) ⇒ Object
-
#initialize ⇒ LastModifiedStore
constructor
A new instance of LastModifiedStore.
- #remove(labels) ⇒ Object
- #set_last_updated(labels) ⇒ Object
- #synchronize ⇒ Object
Constructor Details
#initialize ⇒ LastModifiedStore
Returns a new instance of LastModifiedStore.
261 262 263 264 |
# File 'lib/fluent/plugin/prometheus.rb', line 261 def initialize @internal_store = Hash.new @lock = Monitor.new end |
Instance Method Details
#get_labels_not_modified_since(time) ⇒ Object
282 283 284 285 286 |
# File 'lib/fluent/plugin/prometheus.rb', line 282 def get_labels_not_modified_since(time) synchronize do @internal_store.select { |k, v| v < time }.keys end end |
#remove(labels) ⇒ Object
276 277 278 279 280 |
# File 'lib/fluent/plugin/prometheus.rb', line 276 def remove(labels) synchronize do @internal_store.delete(labels) end end |
#set_last_updated(labels) ⇒ Object
270 271 272 273 274 |
# File 'lib/fluent/plugin/prometheus.rb', line 270 def set_last_updated(labels) synchronize do @internal_store[labels] = Time.now end end |
#synchronize ⇒ Object
266 267 268 |
# File 'lib/fluent/plugin/prometheus.rb', line 266 def synchronize @lock.synchronize { yield } end |