Module: NdrStats

Extended by:
Config, Stats
Defined in:
lib/ndr_stats.rb,
lib/ndr_stats/ping.rb,
lib/ndr_stats/stats.rb,
lib/ndr_stats/config.rb,
lib/ndr_stats/railtie.rb,
lib/ndr_stats/version.rb

Overview

Code to allow instrumentation to be fed back to prometheus.

# Icrement a counter by one:
NdrStats.count('sheep', colour: 'black')
# Or by many:
NdrStats.count('rabbits', 10)

# Set a gauge:
NdrStats.gauge('active_daemons', 10)

# Time some code:
NdrStats.time('validation', class: 'Tumour') { @tumour.valid? }

Defined Under Namespace

Modules: Config, Stats Classes: Ping, Railtie

Constant Summary collapse

VERSION =
'0.2.1'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Config

configure, configured?

Methods included from Stats

count, gauge, time, timing

Class Attribute Details

.adaptorObject

Returns the value of attribute adaptor.



26
27
28
# File 'lib/ndr_stats.rb', line 26

def adaptor
  @adaptor
end

Class Method Details

.ping(**args) ⇒ Object

# set a custom frequency (defaults to every minute):

NdrStats.ping(type: 'sloth', every: 3.hours)


39
40
41
# File 'lib/ndr_stats.rb', line 39

def ping(**args)
  Ping.register(**args)
end