Module: Nunes

Defined in:
lib/nunes.rb,
lib/nunes/adapter.rb,
lib/nunes/version.rb,
lib/nunes/subscriber.rb,
lib/nunes/instrumentable.rb,
lib/nunes/adapters/memory.rb,
lib/nunes/subscribers/nunes.rb,
lib/nunes/subscribers/active_job.rb,
lib/nunes/adapters/timing_aliased.rb,
lib/nunes/subscribers/action_view.rb,
lib/nunes/subscribers/action_mailer.rb,
lib/nunes/subscribers/active_record.rb,
lib/nunes/subscribers/active_support.rb,
lib/nunes/subscribers/action_controller.rb

Defined Under Namespace

Modules: Adapters, Instrumentable, Subscribers Classes: Adapter, Subscriber

Constant Summary collapse

NAMESPACE_SEPARATOR =

Private: What ruby uses to separate namespaces.

"::".freeze
METRIC_NAMESPACE_SEPARATOR =

Private: What nunes uses to separate namespaces in the metric.

"-".freeze
VERSION =
"0.5.0"

Class Method Summary collapse

Class Method Details

.class_to_metric(class_or_class_name) ⇒ Object

Private: Converts a class to a metric safe name.


48
49
50
51
# File 'lib/nunes.rb', line 48

def self.class_to_metric(class_or_class_name)
  return if class_or_class_name.nil?
  class_or_class_name.to_s.gsub(NAMESPACE_SEPARATOR, METRIC_NAMESPACE_SEPARATOR)
end

.subscribe(client) ⇒ Object

Public: Shortcut method to setup all subscribers for a given client.

client - The instance that will be adapted and receive all instrumentation.

Examples:

Nunes.subscribe(Statsd.new)
Nunes.subscribe(Instrumental::Agent.new)

Returns Array of subscribers that were setup.


26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/nunes.rb', line 26

def self.subscribe(client)
  subscribers = []
  adapter = Nunes::Adapter.wrap(client)

  subscribers << Subscribers::ActionController.subscribe(adapter)
  subscribers << Subscribers::ActionView.subscribe(adapter)
  subscribers << Subscribers::ActionMailer.subscribe(adapter)
  subscribers << Subscribers::ActiveSupport.subscribe(adapter)
  subscribers << Subscribers::ActiveRecord.subscribe(adapter)
  subscribers << Subscribers::ActiveJob.subscribe(adapter)
  subscribers << Subscribers::Nunes.subscribe(adapter)

  subscribers
end