mirror of
https://github.com/jimeh/airbrake-statsd.git
synced 2026-02-19 10:56:43 +00:00
41 lines
792 B
Ruby
41 lines
792 B
Ruby
require 'airbrake'
|
|
require 'statsd'
|
|
|
|
require 'airbrake-statsd/version'
|
|
require 'airbrake-statsd/configuration'
|
|
require 'airbrake-statsd/airbrake_ext'
|
|
|
|
module Airbrake
|
|
module Statsd
|
|
class << self
|
|
|
|
def configure(&block)
|
|
@configured = true
|
|
block.call(config) if block_given?
|
|
end
|
|
|
|
def configured?
|
|
!!@configured
|
|
end
|
|
|
|
def config
|
|
@config ||= Configuration.new
|
|
end
|
|
|
|
def client
|
|
@client ||= begin
|
|
client = ::Statsd.new(config.host, config.port)
|
|
client.namespace = config.namespace if config.namespace
|
|
client
|
|
end
|
|
end
|
|
|
|
def increment
|
|
return unless configured?
|
|
client.increment(config.bucket)
|
|
end
|
|
|
|
end # << self
|
|
end # Statsd
|
|
end # Airbrake
|