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 Method Summary collapse

Constructor Details

#initialize(changes, origin) ⇒ AppClientConfigurationChange

Returns a new instance of AppClientConfigurationChange.



270
271
272
273
274
# File 'lib/datadog/core/telemetry/event.rb', line 270

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

Instance Method Details

#configurationObject



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/datadog/core/telemetry/event.rb', line 280

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

#payloadObject



276
277
278
# File 'lib/datadog/core/telemetry/event.rb', line 276

def payload
  { configuration: configuration }
end

#typeObject



266
267
268
# File 'lib/datadog/core/telemetry/event.rb', line 266

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