Class: Datadog::Core::Telemetry::Event::AppClientConfigurationChange

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

Overview

Telemetry class for the ‘app-client-configuration-change’ event

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changes, origin) ⇒ AppClientConfigurationChange

Returns a new instance of AppClientConfigurationChange.



288
289
290
291
292
# File 'lib/datadog/core/telemetry/event.rb', line 288

def initialize(changes, origin)
  super()
  @changes = changes
  @origin = origin
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



282
283
284
# File 'lib/datadog/core/telemetry/event.rb', line 282

def changes
  @changes
end

#originObject (readonly)

Returns the value of attribute origin.



282
283
284
# File 'lib/datadog/core/telemetry/event.rb', line 282

def origin
  @origin
end

Instance Method Details

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



323
324
325
# File 'lib/datadog/core/telemetry/event.rb', line 323

def ==(other)
  other.is_a?(AppClientConfigurationChange) && other.changes == @changes && other.origin == @origin
end

#configurationObject



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/datadog/core/telemetry/event.rb', line 298

def configuration
  config = Datadog.configuration
  seq_id = Event.configuration_sequence.next

  res = @changes.map do |name, value|
    {
      name: name,
      value: value,
      origin: @origin,
      seq_id: seq_id,
    }
  end

  unless config.dig('appsec', 'sca_enabled').nil?
    res << {
      name: 'appsec.sca_enabled',
      value: config.appsec.sca_enabled,
      origin: 'code',
      seq_id: seq_id,
    }
  end

  res
end

#hashObject



329
330
331
# File 'lib/datadog/core/telemetry/event.rb', line 329

def hash
  [self.class, @changes, @origin].hash
end

#payloadObject



294
295
296
# File 'lib/datadog/core/telemetry/event.rb', line 294

def payload
  { configuration: configuration }
end

#typeObject



284
285
286
# File 'lib/datadog/core/telemetry/event.rb', line 284

def type
  'app-client-configuration-change'
end