Sha256: 6088be0acdd8d37ac0905fd93c56b105fe5ee70ccdac1788f499adc2b26790da
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 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 class << self # 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-6.1.0 | lib/contrast/agent/telemetry/events/exceptions/telemetry_exceptions_report.rb |