Sha256: c6304db1961cdf0d5a0ca7cc9e28fb9bc4f2ef98f4c4076c68bf560b50cf734e

Contents?: true

Size: 731 Bytes

Versions: 6

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

module Mnemosyne
  module Probes
    module Grape
      module EndpointRun
        class Probe < ::Mnemosyne::Probe
          subscribe 'endpoint_run.grape'

          def call(trace, _name, start, finish, _id, payload)
            start  = ::Mnemosyne::Clock.to_tick(start)
            finish = ::Mnemosyne::Clock.to_tick(finish)

            endpoint = payload[:endpoint]
            return unless endpoint

            span = ::Mnemosyne::Span.new 'app.controller.request.grape',
              start: start, finish: finish

            trace << span
          end
        end
      end
    end

    register 'Grape::Endpoint',
      'grape/endpoint',
      Grape::EndpointRun::Probe.new
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mnemosyne-ruby-1.4.0 lib/mnemosyne/probes/grape/endpoint_run.rb
mnemosyne-ruby-1.3.0 lib/mnemosyne/probes/grape/endpoint_run.rb
mnemosyne-ruby-1.2.1 lib/mnemosyne/probes/grape/endpoint_run.rb
mnemosyne-ruby-1.2.0 lib/mnemosyne/probes/grape/endpoint_run.rb
mnemosyne-ruby-1.1.0 lib/mnemosyne/probes/grape/endpoint_run.rb
mnemosyne-ruby-1.1.0.rc1 lib/mnemosyne/probes/grape/endpoint_run.rb