class Gremlin::NotificationObserver::SummaryReceiver

Public Class Methods

new(name, docstring, labels, payload_field) click to toggle source
# File lib/gremlin/notification_observer.rb, line 21
def initialize(name, docstring, labels, payload_field)
  @instrument = Gremlin::Instruments::Summary.new(name, docstring, labels)
  begin
    Gremlin.registry.register @instrument
  rescue Gremlin::Registry::AlreadyRegisteredError; end
  @field_to_observe = payload_field
end

Public Instance Methods

call(name, start, finish, id, payload) click to toggle source
# File lib/gremlin/notification_observer.rb, line 29
def call(name, start, finish, id, payload)
  instrument.observe({}, payload[@field_to_observe.to_sym])
end
instrument() click to toggle source
# File lib/gremlin/notification_observer.rb, line 33
def instrument
  Gremlin.registry.get(@instrument.name)
end