Sha256: 3ec0da86ca9493bab1eaffdceedd4c50e21964dd9daf604eb11dce40ac2c07d1

Contents?: true

Size: 1.36 KB

Versions: 18

Compression:

Stored size: 1.36 KB

Contents

# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/agent/reporting/reporting_events/reporting_event'
require 'contrast/utils/timer'

module Contrast
  module Agent
    module Reporting
      # This is the new ServerReportingEvent class which will include all the needed and mutual information for those
      # events which correspond to Servers, such as Servers Activity.
      #
      # @abstract
      class ServerReportingEvent < Contrast::Agent::Reporting::ReportingEvent
        protected

        # The timestamp field is a bit of a misnomer. It's really the time, in ms, since the settings for this
        # application have been updated. If I've never updated, then it's been 0ms since then.
        #
        # @return [Integer]
        def since_last_update
          (update_time = Contrast::SETTINGS.last_server_update_ms) ? Contrast::Utils::Timer.now_ms - update_time : 0
        end

        # Human readable last time update for header set. Set to 0 if the agent is just starting and have not received
        # the latest header from TS.
        #
        # @return [String]
        def since_last_update_httpdate
          Contrast::SETTINGS.server_settings_last_httpdate || Contrast::Utils::Timer.ms_to_httpdate(0)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contrast-agent-7.6.1 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.6.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.5.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.4.1 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.4.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.3.2 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.3.1 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.3.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.2.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.1.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-7.0.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.15.3 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.15.2 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.15.1 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.15.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.14.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.13.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
contrast-agent-6.12.0 lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb