Sha256: e548942a35d5c6d1b19d4844bec929a60334ec35d72ce85e8b659a1e3911d52d

Contents?: true

Size: 1.84 KB

Versions: 11

Compression:

Stored size: 1.84 KB

Contents

module Datadog
  module Core
    module Telemetry
      module V1
        # Describes payload for telemetry V1 API app-integrations-change event
        class AppEvent
          include Kernel

          attr_reader \
            :additional_payload,
            :configuration,
            :dependencies,
            :integrations

          # @param additional_payload [Array<Telemetry::V1::Configuration>] List of Additional payload to track (any key
          #   value not mentioned and doesn't fit under a metric)
          # @param configuration [Array<Telemetry::V1::Configuration>] List of Tracer related configuration data
          # @param dependencies [Array<Telemetry::V1::Dependency>] List of all loaded modules requested by the app
          # @param integrations [Array<Telemetry::V1::Integration>] List of integrations that are available within the app
          #   and applicable to be traced
          def initialize(additional_payload: nil, configuration: nil, dependencies: nil, integrations: nil)
            @additional_payload = additional_payload
            @configuration = configuration
            @dependencies = dependencies
            @integrations = integrations
          end

          def to_h
            {}.tap do |hash|
              hash[:additional_payload] = map_hash(@additional_payload) if @additional_payload
              hash[:configuration] = map_hash(@configuration) if @configuration
              hash[:dependencies] = map_array(@dependencies) if @dependencies
              hash[:integrations] = map_array(@integrations) if @integrations
            end
          end

          private

          def map_hash(hash)
            hash.map do |k, v|
              { name: k.to_s, value: v }
            end
          end

          def map_array(arr)
            arr.map(&:to_h)
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ddtrace-1.9.0 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.8.0 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.7.0 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.6.1 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.6.0 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.5.2 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.5.1 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.5.0 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.4.2 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.4.1 lib/datadog/core/telemetry/v1/app_event.rb
ddtrace-1.4.0 lib/datadog/core/telemetry/v1/app_event.rb