Class: SolidApm::SpanSubscriber::ActionDispatch

Inherits:
Base
  • Object
show all
Defined in:
app/models/solid_apm/span_subscriber/action_dispatch.rb

Constant Summary collapse

PATTERN =
/\w+\.action_dispatch/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, subscribe!

Class Method Details

.subscribeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/solid_apm/span_subscriber/action_dispatch.rb', line 7

def self.subscribe
  super do |name, start, finish, id, payload|
    transaction = SpanSubscriber::Base.transaction
    transaction.name = "#{payload[:request].controller_class}##{payload[:request].path_parameters[:action]}"
    transaction.end_time = finish
    transaction.duration = ((transaction.end_time.to_f - transaction.timestamp.to_f) * 1000).round(6)
    transaction. = {
      params: payload[:request].params.except(:controller, :action),
      context: SpanSubscriber::Base.context
    }
    SpanSubscriber::Base.context = nil
  end
end

Instance Method Details

#summary(payload) ⇒ Object



21
22
23
# File 'app/models/solid_apm/span_subscriber/action_dispatch.rb', line 21

def summary(payload)
  "#{payload[:request].controller_class}##{payload[:request].path_parameters[:action]}"
end