Sha256: 10ca9d479e3ed64b72da16407c942a8393f3da30d662df122f867ec0c60aaff5

Contents?: true

Size: 612 Bytes

Versions: 2

Compression:

Stored size: 612 Bytes

Contents

require 'vitals/integrations/notifications/base'

module Vitals::Integrations::Notifications
  class Grape < Base
    def self.event_name
      'endpoint_run.grape'
    end

    private

    def self.handle(name, started, finished, unique_id, payload)
      endpoint = payload[:endpoint]
      route    = endpoint.route
      method   = route.route_method.downcase

      path = Vitals::Utils.grape_path(route)

      # TODO move 'grape' to configuration opts in subscribe!(opts)
      m = "grape.#{path}_#{method}.#{endpoint.status}.all"
      Vitals.timing(m, duration(started, finished))
    end

  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vitals-0.5.0 lib/vitals/integrations/notifications/grape.rb
vitals-0.4.0 lib/vitals/integrations/notifications/grape.rb