Class: GH::Instrumentation

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/gh/instrumentation.rb

Overview

Public: This class caches responses.

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#backend, #options

Instance Method Summary collapse

Methods inherited from Wrapper

[], #frontend, #frontend=, #generate_response, #initialize, #inspect, #prefixed, #reset, wraps

Constructor Details

This class inherits a constructor from GH::Wrapper

Instance Attribute Details

#instrumenterObject

Public: Get/set instrumenter to use. Compatible with ActiveSupport::Notification and Travis::EventLogger.



7
8
9
# File 'lib/gh/instrumentation.rb', line 7

def instrumenter
  @instrumenter
end

Instance Method Details

#[](key) ⇒ Object



23
24
25
# File 'lib/gh/instrumentation.rb', line 23

def [](key)
  instrument(:access, :key => key) { super }
end

#http(verb, url) ⇒ Object



15
16
17
# File 'lib/gh/instrumentation.rb', line 15

def http(verb, url, *)
  instrument(:http, :verb => verb, :url => url) { super }
end

#load(data) ⇒ Object



19
20
21
# File 'lib/gh/instrumentation.rb', line 19

def load(data)
  instrument(:load, :data => data) { super }
end

#setup(backend, options) ⇒ Object



9
10
11
12
13
# File 'lib/gh/instrumentation.rb', line 9

def setup(backend, options)
  self.instrumenter ||= Travis::EventLogger.method(:notify)              if defined? Travis::EventLogger
  self.instrumenter ||= ActiveSupport::Notifications.method(:instrument) if defined? ActiveSupport::Notifications
  super
end