Module: HostedGraphite

Extended by:
Forwardable, HostedGraphite
Included in:
HostedGraphite
Defined in:
lib/hosted_graphite/protocols/http.rb,
lib/hosted_graphite.rb,
lib/hosted_graphite/testing.rb,
lib/hosted_graphite/version.rb,
lib/hosted_graphite/protocol.rb,
lib/hosted_graphite/ext/sidekiq.rb,
lib/hosted_graphite/protocols/tcp.rb,
lib/hosted_graphite/protocols/udp.rb,
lib/hosted_graphite/protocols/statsd.rb

Overview

ANALYSE, is this implementation thread safe ?

Defined Under Namespace

Modules: Ext Classes: HTTP, MissingAPIKey, Protocol, STATSD, TCP, UDP

Constant Summary collapse

VERSION =
'0.2.0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject



20
21
22
# File 'lib/hosted_graphite.rb', line 20

def api_key
  @api_key ||= ENV['HOSTEDGRAPHITE_APIKEY']
end

#enabledObject

Returns the value of attribute enabled.



10
11
12
# File 'lib/hosted_graphite.rb', line 10

def enabled
  @enabled
end

#namespaceObject

Returns the value of attribute namespace.



10
11
12
# File 'lib/hosted_graphite.rb', line 10

def namespace
  @namespace
end

#protocolObject

Returns the value of attribute protocol.



11
12
13
# File 'lib/hosted_graphite.rb', line 11

def protocol
  @protocol
end

Class Method Details

.send_metric(*args) ⇒ Object



28
29
30
# File 'lib/hosted_graphite.rb', line 28

def send_metric(*args)
  protocol.send_metric(*args) if enabled?
end

.testingObject Also known as: increment, decrement, count, gauge, set, timing, time



20
21
22
# File 'lib/hosted_graphite/testing.rb', line 20

def testing(*)
  yield if block_given?
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/hosted_graphite.rb', line 24

def enabled?
  @enabled.nil? ? true : @enabled
end

#statsdObject



23
24
25
# File 'lib/hosted_graphite/protocols/statsd.rb', line 23

def statsd
  @statsd ||= STATSD.new
end