Class: Airbrake::PerformanceBreakdown

Inherits:
Object
  • Object
show all
Includes:
HashKeyable, Ignorable, Mergeable, Stashable
Defined in:
lib/airbrake-ruby/performance_breakdown.rb

Overview

PerformanceBreakdown holds data that shows how much time a request spent doing certaing subtasks such as (DB querying, view rendering, etc).

rubocop:disable Metrics/ParameterLists

See Also:

  • notify_breakdown

Since:

  • v4.2.0

Instance Attribute Summary collapse

Attributes included from Ignorable

#ignored

Instance Method Summary collapse

Methods included from Mergeable

#merge

Methods included from Stashable

#stash

Methods included from Ignorable

#ignore!, #ignored?

Methods included from HashKeyable

#eql?, #hash

Constructor Details

#initialize(method:, route:, response_type:, groups:, timing: nil, time: Time.now) ⇒ PerformanceBreakdown

Returns a new instance of PerformanceBreakdown.

Since:

  • v4.2.0



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 17

def initialize(
  method:,
  route:,
  response_type:,
  groups:,
  timing: nil,
  time: Time.now
)
  @time_utc = TimeTruncate.utc_truncate_minutes(time)
  @method = method
  @route = route
  @response_type = response_type
  @groups = groups
  @timing = timing
  @time = time
end

Instance Attribute Details

#groupsObject

Since:

  • v4.2.0



15
16
17
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 15

def groups
  @groups
end

#methodObject

Since:

  • v4.2.0



15
16
17
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 15

def method
  @method
end

#response_typeObject

Since:

  • v4.2.0



15
16
17
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 15

def response_type
  @response_type
end

#routeObject

Since:

  • v4.2.0



15
16
17
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 15

def route
  @route
end

#timeObject

Since:

  • v4.2.0



15
16
17
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 15

def time
  @time
end

#timingObject

Since:

  • v4.2.0



15
16
17
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 15

def timing
  @timing
end

Instance Method Details

#cargoObject

Since:

  • v4.2.0



38
39
40
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 38

def cargo
  'routes'
end

#destinationObject

Since:

  • v4.2.0



34
35
36
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 34

def destination
  'routes-breakdowns'
end

#to_hObject

Since:

  • v4.2.0



42
43
44
45
46
47
48
49
# File 'lib/airbrake-ruby/performance_breakdown.rb', line 42

def to_h
  {
    'method' => method,
    'route' => route,
    'responseType' => response_type,
    'time' => @time_utc,
  }.delete_if { |_key, val| val.nil? }
end