Class: Datadog::Core::Telemetry::Event::MessageBatch

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/telemetry/event.rb

Overview

Telemetry class for the ‘message-batch’ event

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events) ⇒ MessageBatch

Returns a new instance of MessageBatch.



460
461
462
# File 'lib/datadog/core/telemetry/event.rb', line 460

def initialize(events)
  @events = events
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



454
455
456
# File 'lib/datadog/core/telemetry/event.rb', line 454

def events
  @events
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



473
474
475
# File 'lib/datadog/core/telemetry/event.rb', line 473

def ==(other)
  other.is_a?(MessageBatch) && other.events == @events
end

#hashObject



479
480
481
# File 'lib/datadog/core/telemetry/event.rb', line 479

def hash
  [self.class, @events].hash
end

#payloadObject



464
465
466
467
468
469
470
471
# File 'lib/datadog/core/telemetry/event.rb', line 464

def payload
  @events.map do |event|
    {
      request_type: event.type,
      payload: event.payload,
    }
  end
end

#typeObject



456
457
458
# File 'lib/datadog/core/telemetry/event.rb', line 456

def type
  'message-batch'
end