Class: Nunes::Adapters::TimingAliased

Inherits:
Nunes::Adapter show all
Defined in:
lib/nunes/adapters/timing_aliased.rb

Overview

Internal: Adapter that aliases timing to gauge. One of the supported places to send instrumentation data is instrumentalapp.com. Their agent uses gauge under the hood for timing information. This adapter is used to adapter their gauge interface to the timing one used internally in the gem. This should never need to be used directly by a user of the gem.

Constant Summary

Constants inherited from Nunes::Adapter

Nunes::Adapter::Nothing, Nunes::Adapter::ReplaceRegex, Nunes::Adapter::Separator

Instance Attribute Summary

Attributes inherited from Nunes::Adapter

#client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Nunes::Adapter

adapters, #increment, #initialize, #prepare, wrap

Constructor Details

This class inherits a constructor from Nunes::Adapter

Class Method Details

.wraps?(client) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/nunes/adapters/timing_aliased.rb', line 11

def self.wraps?(client)
  client.respond_to?(:increment) &&
    client.respond_to?(:gauge) &&
    !client.respond_to?(:timing)
end

Instance Method Details

#timing(metric, duration) ⇒ Object

Internal: Adapter timing to gauge.



18
19
20
# File 'lib/nunes/adapters/timing_aliased.rb', line 18

def timing(metric, duration)
  @client.gauge prepare(metric), duration
end