27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/appsignal/integrations/hanami.rb', line 27
def call(env)
params = ::Hanami::Action::BaseParams.new(env)
request = ::Hanami::Action::Request.new(
:env => env,
:params => params,
:sessions_enabled => true
)
transaction = Appsignal::Transaction.create(
SecureRandom.uuid,
Appsignal::Transaction::HTTP_REQUEST,
request
)
begin
Appsignal.instrument("process_action.hanami") do
super.tap do |response|
transaction.set_metadata("status", response.status.to_s)
end
end
rescue Exception => error transaction.set_error(error)
transaction.set_metadata("status", "500")
raise error
ensure
transaction.params = request.params.to_h
transaction.set_action_if_nil(self.class.name)
transaction.set_metadata("path", request.path)
transaction.set_metadata("method", request.request_method)
transaction.set_http_or_background_queue_start
Appsignal::Transaction.complete_current!
end
end
|