Module: CoAspects::Aspects::StatsdHelper

Defined in:
lib/co_aspects/aspects/statsd_helper.rb

Class Method Summary collapse

Class Method Details

.default_prefix(klass, method_name) ⇒ Object



6
7
8
# File 'lib/co_aspects/aspects/statsd_helper.rb', line 6

def default_prefix(klass, method_name)
  klass.name.underscore.tr('/', '.') + ".#{method_name}"
end

.key(instance, method_name, method_args, statsd_prefix, statsd_block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/co_aspects/aspects/statsd_helper.rb', line 10

def key(instance, method_name, method_args, statsd_prefix, statsd_block)
  if statsd_prefix || statsd_block
    key = statsd_prefix.to_s
    if statsd_block
      key += instance.instance_exec(*method_args, &statsd_block).to_s
    end
    key.downcase
  else
    default_prefix(instance.class, method_name)
  end
end