Class: Contrast::Agent::Telemetry::MetricEvent

Inherits:
Event show all
Includes:
Utils, Utils::OS
Defined in:
lib/contrast/agent/telemetry/metric_event.rb

Overview

This class will hold the basic information for a Telemetry Event

Direct Known Subclasses

InputAnalysisEvent, StartupMetricsEvent

Instance Attribute Summary collapse

Attributes inherited from Event

#tags

Instance Method Summary collapse

Methods included from Utils::OS

get_system_information, mac?, windows?

Methods included from Components::Scope::InstanceMethods

#contrast_enter_method_scopes!, #contrast_exit_method_scopes!, #with_app_scope, #with_contrast_scope, #with_deserialization_scope, #with_split_scope

Methods inherited from Event

#path

Constructor Details

#initializeMetricEvent

Returns a new instance of MetricEvent.



19
20
21
22
23
# File 'lib/contrast/agent/telemetry/metric_event.rb', line 19

def initialize
  super
  @fields = MetricsHash.new(Numeric)
  @fields['_filler'] = 0
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



17
18
19
# File 'lib/contrast/agent/telemetry/metric_event.rb', line 17

def fields
  @fields
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/contrast/agent/telemetry/metric_event.rb', line 30

def empty?
  Contrast::Utils::DuckUtils.empty_duck?(@fields)
end

#sys_infoObject



25
26
27
28
# File 'lib/contrast/agent/telemetry/metric_event.rb', line 25

def sys_info
  @sys_info ||= get_system_information if @sys_info.nil?
  @sys_info
end

#to_controlled_hash(**_args) ⇒ Object



34
35
36
# File 'lib/contrast/agent/telemetry/metric_event.rb', line 34

def to_controlled_hash **_args
  super.merge!({ fields: @fields })
end