lib/appsignal/transaction.rb in appsignal-0.9.5 vs lib/appsignal/transaction.rb in appsignal-0.9.6

- old
+ new

@@ -83,11 +83,11 @@ @time = Time.now.utc.to_f @exception = ex end def exception? - !!exception + !! exception end def slow_request? return false unless process_action_event && process_action_event.payload Appsignal.config[:slow_request_threshold] <= process_action_event.duration @@ -96,26 +96,38 @@ def slower?(transaction) process_action_event.duration > transaction.process_action_event.duration end def truncate! + return if truncated? process_action_event.payload.clear events.clear tags.clear sanitized_environment.clear sanitized_session_data.clear @env = nil + @truncated = true end + def truncated? + !! @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| Appsignal::Transaction::ParamsSanitizer.sanitize(o.payload) end add_sanitized_context! + @have_values_been_converted_to_primitives = true end + def have_values_been_converted_to_primitives? + !! @have_values_been_converted_to_primitives + end + def type return :exception if exception? return :slow_request if slow_request? :regular_request end @@ -127,9 +139,10 @@ def complete! Thread.current[:appsignal_transaction_id] = nil Appsignal.transactions.delete(@request_id) if process_action_event || exception? if Appsignal::Pipe.current + convert_values_to_primitives! Appsignal.logger.debug("Writing transaction to pipe: #{@request_id}") Appsignal::Pipe.current.write(self) else Appsignal.logger.debug("Enqueueing transaction: #{@request_id}") Appsignal.enqueue(self)