Sha256: de24ad40ab8177c3c4943b0b9eb32b7192ca938442929fde8ef564b46e7c72ca
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module Contrast module Agent module Telemetry # This module will handle the reporting of the TelemetryExceptionHash module TelemetryExceptionReport # Here we will send any exceptions gathered. The telemetry_hash is split into batches of 256 # and then added to the telemetry queue. Since this method is called before entering the # until queue loop any updates after clearing the Contrast::TELEMETRY_EXCEPTIONS would have # to wait for the sending process to be completed, so accumulating new batches. # This methods expects queue and error_messages methods from Contrast::Agent::Telemetry::Base def push_exceptions return unless Contrast::TELEMETRY_EXCEPTIONS&.any? Contrast::TELEMETRY_EXCEPTIONS.values.each_slice(256) { |tuple| error_messages.push(tuple) } # Clear the hash. All exceptions now live in @_error_messages instance variable. and we will # add them to the queue. Clearing would make the hash available to be populated again while the # sending is proceeding. Contrast::TELEMETRY_EXCEPTIONS.clear # Add batch to queue. We need to shift here, because we want to report from the oldest batch to # the newest. And even if somehow the array is filled during sending the new messages would stay # and wait their turn. queue << error_messages.shift until error_messages.empty? end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems