Module: Airbrake::Statsd

Defined in:
lib/airbrake-statsd.rb,
lib/airbrake-statsd/version.rb,
lib/airbrake-statsd/configuration.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.clientObject



25
26
27
28
29
30
31
# File 'lib/airbrake-statsd.rb', line 25

def client
  @client ||= begin
    client = ::Statsd.new(config.host, config.port)
    client.namespace = config.namespace if config.namespace
    client
  end
end

.configObject



21
22
23
# File 'lib/airbrake-statsd.rb', line 21

def config
  @config ||= Configuration.new
end

.configure(&block) ⇒ Object



12
13
14
15
# File 'lib/airbrake-statsd.rb', line 12

def configure(&block)
  @configured = true
  block.call(config) if block_given?
end

.configured?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/airbrake-statsd.rb', line 17

def configured?
  !!@configured
end

.incrementObject



33
34
35
36
# File 'lib/airbrake-statsd.rb', line 33

def increment
  return unless configured?
  client.increment(config.bucket)
end