Class: Datadog::DI::SnapshotEvent Private

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/di/snapshot_event.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A snapshot payload queued for sending to the agent, paired with the guardrails event type of the probe that produced it, so drop metrics can be tagged with the probe's classification.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload:, event_type:) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the event.

Parameters:

  • payload (Hash) —

    the snapshot payload to send to the agent

  • event_type (String) —

    one of GuardrailsTelemetry::EVENT_TYPE_SNAPSHOT and EVENT_TYPE_LOG



15
16
17
18
# File 'lib/datadog/di/snapshot_event.rb', line 15

def initialize(payload:, event_type:)
  @payload = payload
  @event_type = event_type
end

Instance Attribute Details

#event_type ⇒ String (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The guardrails event type of the probe that produced the payload.

Returns:

  • (String) —

    one of GuardrailsTelemetry::EVENT_TYPE_SNAPSHOT and EVENT_TYPE_LOG



26
27
28
# File 'lib/datadog/di/snapshot_event.rb', line 26

def event_type
  @event_type
end

#payload ⇒ Hash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The snapshot payload to send to the agent.

Returns:

  • (Hash)


22
23
24
# File 'lib/datadog/di/snapshot_event.rb', line 22

def payload
  @payload
end

Instance Method Details

#==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compares two events by payload and event type.

Parameters:

  • other (Object) —

    the object to compare with

Returns:

  • (Boolean) —

    whether the other object is an event with the same payload and event type



33
34
35
# File 'lib/datadog/di/snapshot_event.rb', line 33

def ==(other)
  other.is_a?(SnapshotEvent) && other.payload == payload && other.event_type == event_type
end