Module: Airbrake::Rack

Defined in:
lib/airbrake/rack.rb,
lib/airbrake/rack/user.rb,
lib/airbrake/rack/middleware.rb,
lib/airbrake/rack/user_filter.rb,
lib/airbrake/rack/route_filter.rb,
lib/airbrake/rack/request_store.rb,
lib/airbrake/rack/context_filter.rb,
lib/airbrake/rack/instrumentable.rb,
lib/airbrake/rack/session_filter.rb,
lib/airbrake/rack/http_params_filter.rb,
lib/airbrake/rack/http_headers_filter.rb,
lib/airbrake/rack/request_body_filter.rb

Overview

Rack is a namespace for all Rack-related code.

Defined Under Namespace

Modules: Instrumentable, RequestStore Classes: ContextFilter, HttpHeadersFilter, HttpParamsFilter, Middleware, RequestBodyFilter, RouteFilter, SessionFilter, User, UserFilter

Class Method Summary collapse

Class Method Details

.capture_timing(label) ⇒ Object

Since:

  • v9.2.0



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/airbrake/rack.rb', line 20

def self.capture_timing(label)
  return yield unless Airbrake::Config.instance.performance_stats

  routes = Airbrake::Rack::RequestStore[:routes]
  if !routes || routes.none?
    result = yield
  else
    timed_trace = Airbrake::TimedTrace.span(label) do
      result = yield
    end

    routes.each do |_route_path, params|
      params[:groups].merge!(timed_trace.spans)
    end
  end

  result
end