Class: Startback::Caching::Prometheus

Inherits:
Object
  • Object
show all
Defined in:
lib/startback/caching/prometheus.rb

Instance Method Summary collapse

Constructor Details

#initializePrometheus

Returns a new instance of Prometheus.



7
8
9
10
11
12
# File 'lib/startback/caching/prometheus.rb', line 7

def initialize
  @cache_hit_counter = cache_counter('hit')
  @cache_outdated_counter = cache_counter('outdated')
  @cache_miss_counter = cache_counter('miss')
  @cache_fail_counter = cache_counter('fail')
end

Instance Method Details

#cache_fail(entity_cache, *args, &bl) ⇒ Object



32
33
34
35
36
# File 'lib/startback/caching/prometheus.rb', line 32

def cache_fail(entity_cache, *args, &bl)
  @cache_fail_counter.increment(labels: {
    entity_cache: entity_cache.class.name,
  })
end

#cache_hit(entity_cache, *args, &bl) ⇒ Object



14
15
16
17
18
# File 'lib/startback/caching/prometheus.rb', line 14

def cache_hit(entity_cache, *args, &bl)
  @cache_hit_counter.increment(labels: {
    entity_cache: entity_cache.class.name,
  })
end

#cache_miss(entity_cache, *args, &bl) ⇒ Object



26
27
28
29
30
# File 'lib/startback/caching/prometheus.rb', line 26

def cache_miss(entity_cache, *args, &bl)
  @cache_miss_counter.increment(labels: {
    entity_cache: entity_cache.class.name,
  })
end

#cache_outdated(entity_cache, *args, &bl) ⇒ Object



20
21
22
23
24
# File 'lib/startback/caching/prometheus.rb', line 20

def cache_outdated(entity_cache, *args, &bl)
  @cache_outdated_counter.increment(labels: {
    entity_cache: entity_cache.class.name,
  })
end