lib/appsignal/transaction.rb in appsignal-0.10.6 vs lib/appsignal/transaction.rb in appsignal-0.11.0.beta.1
- old
+ new
@@ -1,6 +1,6 @@
- module Appsignal
+module Appsignal
class Transaction
# Based on what Rails uses + some variables we'd like to show
ENV_METHODS = %w(CONTENT_LENGTH AUTH_TYPE GATEWAY_INTERFACE
PATH_TRANSLATED REMOTE_HOST REMOTE_IDENT REMOTE_USER REMOTE_ADDR
REQUEST_METHOD SERVER_NAME SERVER_PORT SERVER_PROTOCOL REQUEST_URI PATH_INFO
@@ -95,13 +95,17 @@
def slower?(transaction)
process_action_event.duration > transaction.process_action_event.duration
end
+ def clear_events!
+ events.clear
+ end
+
def truncate!
return if truncated?
- process_action_event.payload.clear
+ process_action_event.truncate!
events.clear
tags.clear
sanitized_environment.clear
sanitized_session_data.clear
@env = nil
@@ -112,16 +116,12 @@
!! @truncated
end
def convert_values_to_primitives!
return if have_values_been_converted_to_primitives?
- Appsignal::Transaction::ParamsSanitizer.sanitize!(@process_action_event.payload) if @process_action_event
- @events.map do |o|
- o.payload.each do |key, value|
- o.payload[key] = Appsignal::Transaction::ParamsSanitizer.sanitize(value)
- end
- end
+ @process_action_event.sanitize! if @process_action_event
+ @events.each { |event| event.sanitize! }
add_sanitized_context!
@have_values_been_converted_to_primitives = true
end
def have_values_been_converted_to_primitives?
@@ -140,14 +140,13 @@
def complete!
Thread.current[:appsignal_transaction_id] = nil
Appsignal.transactions.delete(@request_id)
if process_action_event || exception?
- if Appsignal::Pipe.current
+ if Appsignal::IPC::Client.active?
convert_values_to_primitives!
- Appsignal.logger.debug("Writing transaction to pipe: #{@request_id}")
- Appsignal::Pipe.current.write(self)
+ Appsignal::IPC::Client.enqueue(self)
else
Appsignal.logger.debug("Enqueueing transaction: #{@request_id}")
Appsignal.enqueue(self)
end
else
@@ -202,10 +201,10 @@
sanitized_environment[key] = value if ENV_METHODS.include?(key)
end
end
def sanitize_session_data!
- @sanitized_session_data = Appsignal::Transaction::ParamsSanitizer.sanitize(
+ @sanitized_session_data = Appsignal::ParamsSanitizer.sanitize(
request.session.to_hash
) if Appsignal.config[:skip_session_data] == false
@fullpath = request.fullpath
end
end