Sha256: 499d9da2f1652958a947dd19f72324a29f3ae1acc8a8947830e0a52f8c403ea1

Contents?: true

Size: 780 Bytes

Versions: 4

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

module Mnemosyne
  module Probes
    module Grape
      module EndpointRender
        class Probe < ::Mnemosyne::Probe
          subscribe 'endpoint_render.grape'

          # rubocop:disable Metrics/ParameterLists
          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 'view.render.grape',
              start: start, finish: finish

            trace << span
          end
        end
      end
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mnemosyne-ruby-1.0.1 lib/mnemosyne/probes/grape/endpoint_render.rb
mnemosyne-ruby-1.0.0 lib/mnemosyne/probes/grape/endpoint_render.rb
mnemosyne-ruby-0.2.0 lib/mnemosyne/probes/grape/endpoint_render.rb
mnemosyne-ruby-0.1.0 lib/mnemosyne/probes/grape/endpoint_render.rb