Sha256: f4ae522f6fe3f24cfe70c28db19c70208fcbbb337e2b5073765ba3943cf6825b

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

require 'datadog/ci/context_flush'

module Datadog
  module CI
    module Configuration
      # Adds CI behavior to Datadog trace components
      module Components
        def initialize(settings)
          # Activate CI mode if enabled
          activate_ci_mode!(settings) if settings.ci_mode.enabled

          # Initialize normally
          super
        end

        def activate_ci_mode!(settings)
          # Activate underlying tracing test mode
          settings.test_mode.enabled = true

          # Choose user defined ContextFlush or default to CI ContextFlush
          settings.test_mode.context_flush = settings.ci_mode.context_flush \
                                             || Datadog::CI::ContextFlush::Finished.new

          # Pass through any other options
          settings.test_mode.writer_options = settings.ci_mode.writer_options
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-0.51.1 lib/datadog/ci/configuration/components.rb
ddtrace-0.51.0 lib/datadog/ci/configuration/components.rb
ddtrace-0.50.0 lib/datadog/ci/configuration/components.rb