Sha256: 2777c4666afc3290f37415f9bce38a02e4d95a4ceb5911b682badbf895955963

Contents?: true

Size: 1023 Bytes

Versions: 16

Compression:

Stored size: 1023 Bytes

Contents

# typed: false

module Datadog
  module Tracing
    module Contrib
      module Grape
        # Instrumentation for Grape::Endpoint
        module Instrumentation
          def self.included(base)
            base.singleton_class.prepend(ClassMethods)
            base.prepend(InstanceMethods)
          end

          # ClassMethods - implementing instrumentation
          module ClassMethods
            def generate_api_method(*params, &block)
              method_api = super

              proc do |*args|
                ::ActiveSupport::Notifications.instrument('endpoint_render.grape.start_render')
                method_api.call(*args)
              end
            end
          end

          # InstanceMethods - implementing instrumentation
          module InstanceMethods
            def run(*args)
              ::ActiveSupport::Notifications.instrument('endpoint_run.grape.start_process', endpoint: self, env: env)
              super
            end
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ddtrace-1.9.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.8.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.7.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.6.1 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.6.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.5.2 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.5.1 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.5.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.4.2 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.4.1 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.4.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.3.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.2.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.1.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.0.0 lib/datadog/tracing/contrib/grape/instrumentation.rb
ddtrace-1.0.0.beta2 lib/datadog/tracing/contrib/grape/instrumentation.rb