Module: StatsD
- Defined in:
- lib/statsd/instrument.rb
Defined Under Namespace
Modules: Instrument
Constant Summary collapse
- TimeoutClass =
defined?(::SystemTimer) ? ::SystemTimer : ::Timeout
Class Attribute Summary collapse
-
.default_sample_rate ⇒ Object
Returns the value of attribute default_sample_rate.
-
.enabled ⇒ Object
Returns the value of attribute enabled.
-
.host ⇒ Object
Returns the value of attribute host.
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.mode ⇒ Object
Returns the value of attribute mode.
-
.port ⇒ Object
Returns the value of attribute port.
-
.prefix ⇒ Object
Returns the value of attribute prefix.
Class Method Summary collapse
-
.gauge(key, amount) ⇒ Object
gerbals:30|g.
-
.increment(key, delta = 1, sample_rate = default_sample_rate) ⇒ Object
gorets:1|c.
-
.measure(key, milli = nil) ⇒ Object
glork:320|ms.
-
.server=(conn) ⇒ Object
StatsD.server = ‘localhost:1234’.
Class Attribute Details
.default_sample_rate ⇒ Object
Returns the value of attribute default_sample_rate.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def default_sample_rate @default_sample_rate end |
.enabled ⇒ Object
Returns the value of attribute enabled.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def enabled @enabled end |
.host ⇒ Object
Returns the value of attribute host.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def host @host end |
.logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def logger @logger end |
.mode ⇒ Object
Returns the value of attribute mode.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def mode @mode end |
.port ⇒ Object
Returns the value of attribute port.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def port @port end |
.prefix ⇒ Object
Returns the value of attribute prefix.
14 15 16 |
# File 'lib/statsd/instrument.rb', line 14 def prefix @prefix end |
Class Method Details
.gauge(key, amount) ⇒ Object
gerbals:30|g
118 119 120 |
# File 'lib/statsd/instrument.rb', line 118 def self.gauge(key, amount) write(key, amount, :gauge) end |
.increment(key, delta = 1, sample_rate = default_sample_rate) ⇒ Object
gorets:1|c
113 114 115 |
# File 'lib/statsd/instrument.rb', line 113 def self.increment(key, delta = 1, sample_rate = default_sample_rate) write(key, delta, :incr, sample_rate) end |
.measure(key, milli = nil) ⇒ Object
glork:320|ms
102 103 104 105 106 107 108 109 110 |
# File 'lib/statsd/instrument.rb', line 102 def self.measure(key, milli = nil) result = nil ms = milli || Benchmark.ms do result = yield end write(key, ms, :ms) result end |
.server=(conn) ⇒ Object
StatsD.server = ‘localhost:1234’
23 24 25 26 |
# File 'lib/statsd/instrument.rb', line 23 def self.server=(conn) self.host, port = conn.split(':') self.port = port.to_i end |