datadog-ci 1.8.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -2
  3. data/README.md +6 -8
  4. data/exe/ddcirb +3 -1
  5. data/lib/datadog/ci/auto_instrument.rb +8 -0
  6. data/lib/datadog/ci/cli/cli.rb +5 -1
  7. data/lib/datadog/ci/cli/command/exec.rb +29 -0
  8. data/lib/datadog/ci/configuration/settings.rb +3 -21
  9. data/lib/datadog/ci/contrib/ciqueue/integration.rb +34 -0
  10. data/lib/datadog/ci/contrib/ciqueue/patcher.rb +23 -0
  11. data/lib/datadog/ci/contrib/cucumber/formatter.rb +10 -5
  12. data/lib/datadog/ci/contrib/cucumber/integration.rb +5 -14
  13. data/lib/datadog/ci/contrib/cucumber/patcher.rb +2 -6
  14. data/lib/datadog/ci/contrib/instrumentation.rb +173 -0
  15. data/lib/datadog/ci/contrib/integration.rb +101 -117
  16. data/lib/datadog/ci/contrib/knapsack/extension.rb +27 -0
  17. data/lib/datadog/ci/contrib/knapsack/integration.rb +36 -0
  18. data/lib/datadog/ci/contrib/knapsack/patcher.rb +29 -0
  19. data/lib/datadog/ci/contrib/knapsack/runner.rb +66 -0
  20. data/lib/datadog/ci/contrib/minitest/integration.rb +6 -14
  21. data/lib/datadog/ci/contrib/minitest/patcher.rb +1 -5
  22. data/lib/datadog/ci/contrib/minitest/runner.rb +6 -1
  23. data/lib/datadog/ci/contrib/minitest/test.rb +6 -1
  24. data/lib/datadog/ci/contrib/patcher.rb +62 -0
  25. data/lib/datadog/ci/contrib/rspec/example.rb +64 -25
  26. data/lib/datadog/ci/contrib/rspec/example_group.rb +18 -1
  27. data/lib/datadog/ci/contrib/rspec/integration.rb +10 -13
  28. data/lib/datadog/ci/contrib/rspec/patcher.rb +2 -33
  29. data/lib/datadog/ci/contrib/rspec/runner.rb +6 -1
  30. data/lib/datadog/ci/contrib/selenium/capybara_driver.rb +1 -1
  31. data/lib/datadog/ci/contrib/selenium/driver.rb +1 -1
  32. data/lib/datadog/ci/contrib/selenium/integration.rb +6 -10
  33. data/lib/datadog/ci/contrib/selenium/navigation.rb +6 -2
  34. data/lib/datadog/ci/contrib/selenium/patcher.rb +2 -6
  35. data/lib/datadog/ci/contrib/selenium/rum.rb +0 -2
  36. data/lib/datadog/ci/contrib/simplecov/integration.rb +6 -10
  37. data/lib/datadog/ci/contrib/simplecov/patcher.rb +2 -6
  38. data/lib/datadog/ci/test.rb +8 -7
  39. data/lib/datadog/ci/test_optimisation/component.rb +9 -4
  40. data/lib/datadog/ci/test_retries/strategy/retry_new.rb +1 -1
  41. data/lib/datadog/ci/test_visibility/component.rb +2 -2
  42. data/lib/datadog/ci/test_visibility/telemetry.rb +2 -1
  43. data/lib/datadog/ci/version.rb +2 -2
  44. data/lib/datadog/ci.rb +9 -1
  45. metadata +13 -7
  46. data/lib/datadog/ci/contrib/contrib.rb +0 -31
  47. data/lib/datadog/ci/contrib/rspec/knapsack_pro/extension.rb +0 -29
  48. data/lib/datadog/ci/contrib/rspec/knapsack_pro/patcher.rb +0 -26
  49. data/lib/datadog/ci/contrib/rspec/knapsack_pro/runner.rb +0 -62
@@ -3,6 +3,7 @@
3
3
  require_relative "../../ext/test"
4
4
  require_relative "../../git/local_repository"
5
5
  require_relative "../../utils/test_run"
6
+ require_relative "../instrumentation"
6
7
  require_relative "ext"
7
8
 
8
9
  module Datadog
@@ -20,42 +21,25 @@ module Datadog
20
21
  return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
21
22
  return super unless datadog_configuration[:enabled]
22
23
 
23
- test_name = full_description.strip
24
- if metadata[:description].empty?
25
- # for unnamed it blocks this appends something like "example at ./spec/some_spec.rb:10"
26
- test_name << " #{description}"
27
- end
28
-
29
- test_suite_description = fetch_top_level_example_group[:description]
30
- suite_name = "#{test_suite_description} at #{metadata[:example_group][:rerun_file_path]}"
31
-
32
- # remove example group description from test name to avoid duplication
33
- test_name = test_name.sub(test_suite_description, "").strip
34
-
35
- if ci_queue?
36
- suite_name = "#{suite_name} (ci-queue running example [#{test_name}])"
37
- ci_queue_test_span = test_visibility_component.start_test_suite(suite_name)
38
- end
24
+ test_suite_span = test_visibility_component.start_test_suite(datadog_test_suite_name) if ci_queue?
39
25
 
40
26
  # don't report test to RSpec::Core::Reporter until retries are done
41
27
  @skip_reporting = true
42
28
 
43
29
  test_retries_component.with_retries do
44
30
  test_visibility_component.trace_test(
45
- test_name,
46
- suite_name,
31
+ datadog_test_name,
32
+ datadog_test_suite_name,
47
33
  tags: {
48
34
  CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
49
- CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s,
35
+ CI::Ext::Test::TAG_FRAMEWORK_VERSION => datadog_integration.version.to_s,
50
36
  CI::Ext::Test::TAG_SOURCE_FILE => Git::LocalRepository.relative_to_root(metadata[:file_path]),
51
37
  CI::Ext::Test::TAG_SOURCE_START => metadata[:line_number].to_s,
52
- CI::Ext::Test::TAG_PARAMETERS => Utils::TestRun.test_parameters(
53
- metadata: {"scoped_id" => metadata[:scoped_id]}
54
- )
38
+ CI::Ext::Test::TAG_PARAMETERS => datadog_test_parameters
55
39
  },
56
40
  service: datadog_configuration[:service_name]
57
41
  ) do |test_span|
58
- test_span&.itr_unskippable! if metadata[CI::Ext::Test::ITR_UNSKIPPABLE_OPTION]
42
+ test_span&.itr_unskippable! if datadog_unskippable?
59
43
 
60
44
  metadata[:skip] = CI::Ext::Test::ITR_TEST_SKIP_REASON if test_span&.skipped_by_itr?
61
45
 
@@ -86,8 +70,8 @@ module Datadog
86
70
  end
87
71
  end
88
72
 
89
- # this is a special case for ci-queue, we need to finish the test suite span
90
- ci_queue_test_span&.finish
73
+ # this is a special case for ci-queue, we need to finish the test suite span created for a single test
74
+ test_suite_span&.finish
91
75
 
92
76
  # after retries are done, we can finally report the test to RSpec
93
77
  @skip_reporting = false
@@ -105,6 +89,18 @@ module Datadog
105
89
  super(::RSpec::Core::NullReporter)
106
90
  end
107
91
 
92
+ def datadog_test_id
93
+ @datadog_test_id ||= Utils::TestRun.datadog_test_id(
94
+ datadog_test_name,
95
+ datadog_test_suite_name,
96
+ datadog_test_parameters
97
+ )
98
+ end
99
+
100
+ def datadog_unskippable?
101
+ !!metadata[CI::Ext::Test::ITR_UNSKIPPABLE_OPTION]
102
+ end
103
+
108
104
  private
109
105
 
110
106
  def fetch_top_level_example_group
@@ -120,10 +116,53 @@ module Datadog
120
116
  res
121
117
  end
122
118
 
119
+ def datadog_integration
120
+ CI::Contrib::Instrumentation.fetch_integration(:rspec)
121
+ end
122
+
123
123
  def datadog_configuration
124
124
  Datadog.configuration.ci[:rspec]
125
125
  end
126
126
 
127
+ def datadog_test_suite_description
128
+ @datadog_test_suite_description ||= fetch_top_level_example_group[:description]
129
+ end
130
+
131
+ def datadog_test_name
132
+ return @datadog_test_name if defined?(@datadog_test_name)
133
+
134
+ test_name = full_description.strip
135
+ if metadata[:description].empty?
136
+ # for unnamed it blocks this appends something like "example at ./spec/some_spec.rb:10"
137
+ test_name << " #{description}"
138
+ end
139
+
140
+ # remove example group description from test name to avoid duplication
141
+ test_name = test_name.sub(datadog_test_suite_description, "").strip
142
+
143
+ @datadog_test_name = test_name
144
+ end
145
+
146
+ def datadog_test_suite_name
147
+ return @datadog_test_suite_name if defined?(@datadog_test_suite_name)
148
+
149
+ suite_name = "#{datadog_test_suite_description} at #{metadata[:example_group][:rerun_file_path]}"
150
+
151
+ if ci_queue?
152
+ suite_name = "#{suite_name} (ci-queue running example [#{datadog_test_name}])"
153
+ end
154
+
155
+ @datadog_test_suite_name = suite_name
156
+ end
157
+
158
+ def datadog_test_parameters
159
+ return @datadog_test_parameters if defined?(@datadog_test_parameters)
160
+
161
+ @datadog_test_parameters = Utils::TestRun.test_parameters(
162
+ metadata: {"scoped_id" => metadata[:scoped_id]}
163
+ )
164
+ end
165
+
127
166
  def test_visibility_component
128
167
  Datadog.send(:components).test_visibility
129
168
  end
@@ -18,10 +18,17 @@ module Datadog
18
18
  def run(reporter = ::RSpec::Core::NullReporter)
19
19
  return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled]
20
20
  return super unless datadog_configuration[:enabled]
21
+
22
+ # skip the context hooks if all descendant example are going to be skipped
23
+ # IMPORTANT: must happen before top_level? check because skipping hooks must happen
24
+ # even if it is a nested context
25
+ metadata[:skip] = true if all_examples_skipped_by_datadog?
26
+
27
+ # return early because we create Datadog::CI::TestSuite only for top-level example groups
21
28
  return super unless top_level?
22
29
 
23
30
  suite_name = "#{description} at #{file_path}"
24
- test_suite = test_visibility_component.start_test_suite(
31
+ test_suite = test_visibility_component&.start_test_suite(
25
32
  suite_name,
26
33
  tags: {
27
34
  CI::Ext::Test::TAG_SOURCE_FILE => Git::LocalRepository.relative_to_root(metadata[:file_path]),
@@ -47,6 +54,12 @@ module Datadog
47
54
 
48
55
  private
49
56
 
57
+ def all_examples_skipped_by_datadog?
58
+ descendant_filtered_examples.all? do |example|
59
+ !example.datadog_unskippable? && test_optimisation_component&.skippable?(example)
60
+ end
61
+ end
62
+
50
63
  def datadog_configuration
51
64
  Datadog.configuration.ci[:rspec]
52
65
  end
@@ -54,6 +67,10 @@ module Datadog
54
67
  def test_visibility_component
55
68
  Datadog.send(:components).test_visibility
56
69
  end
70
+
71
+ def test_optimisation_component
72
+ Datadog.send(:components).test_optimisation
73
+ end
57
74
  end
58
75
  end
59
76
  end
@@ -9,31 +9,28 @@ module Datadog
9
9
  module Contrib
10
10
  module RSpec
11
11
  # Description of RSpec integration
12
- class Integration
13
- include Datadog::CI::Contrib::Integration
14
-
12
+ class Integration < Contrib::Integration
15
13
  MINIMUM_VERSION = Gem::Version.new("3.0.0")
16
14
 
17
- register_as :rspec
15
+ def dependants
16
+ %i[knapsack ciqueue]
17
+ end
18
18
 
19
- def self.version
19
+ def version
20
20
  Gem.loaded_specs["rspec-core"]&.version
21
21
  end
22
22
 
23
- def self.loaded?
23
+ def loaded?
24
24
  !defined?(::RSpec).nil? && !defined?(::RSpec::Core).nil? &&
25
- !defined?(::RSpec::Core::Example).nil?
25
+ !defined?(::RSpec::Core::Example).nil? &&
26
+ !defined?(::RSpec::Core::Runner).nil? &&
27
+ !defined?(::RSpec::Core::ExampleGroup).nil?
26
28
  end
27
29
 
28
- def self.compatible?
30
+ def compatible?
29
31
  super && version >= MINIMUM_VERSION
30
32
  end
31
33
 
32
- # test environments should not auto instrument test libraries
33
- def auto_instrument?
34
- false
35
- end
36
-
37
34
  def new_configuration
38
35
  Configuration::Settings.new
39
36
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
3
+ require_relative "../patcher"
4
4
 
5
5
  require_relative "example"
6
6
  require_relative "example_group"
@@ -12,46 +12,15 @@ module Datadog
12
12
  module RSpec
13
13
  # Patcher enables patching of 'rspec' module.
14
14
  module Patcher
15
- include Datadog::Tracing::Contrib::Patcher
15
+ include Datadog::CI::Contrib::Patcher
16
16
 
17
17
  module_function
18
18
 
19
- def target_version
20
- Integration.version
21
- end
22
-
23
19
  def patch
24
- # ci-queue test runner instrumentation
25
- # https://github.com/Shopify/ci-queue
26
- if ci_queue?
27
- ::RSpec::Queue::Runner.include(Runner)
28
- end
29
-
30
- if knapsack_pro?
31
- # Knapsack Pro test runner instrumentation
32
- # https://github.com/KnapsackPro/knapsack_pro-ruby
33
- require_relative "knapsack_pro/patcher"
34
- Datadog::CI::Contrib::RSpec::KnapsackPro::Patcher.patch
35
- end
36
-
37
- # default rspec test runner instrumentation
38
20
  ::RSpec::Core::Runner.include(Runner)
39
-
40
21
  ::RSpec::Core::Example.include(Example)
41
22
  ::RSpec::Core::ExampleGroup.include(ExampleGroup)
42
23
  end
43
-
44
- def ci_queue?
45
- !!defined?(::RSpec::Queue::Runner)
46
- end
47
-
48
- def knapsack_pro?
49
- knapsack_version = Gem.loaded_specs["knapsack_pro"]&.version
50
-
51
- # additional instrumentation is needed for KnapsackPro version 7 and later
52
- !!defined?(::KnapsackPro) &&
53
- !knapsack_version.nil? && knapsack_version >= Gem::Version.new("7")
54
- end
55
24
  end
56
25
  end
57
26
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../ext/test"
4
+ require_relative "../instrumentation"
4
5
  require_relative "ext"
5
6
 
6
7
  module Datadog
@@ -21,7 +22,7 @@ module Datadog
21
22
  test_session = test_visibility_component.start_test_session(
22
23
  tags: {
23
24
  CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
24
- CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s
25
+ CI::Ext::Test::TAG_FRAMEWORK_VERSION => datadog_integration.version.to_s
25
26
  },
26
27
  service: datadog_configuration[:service_name],
27
28
  total_tests_count: ::RSpec.world.example_count
@@ -47,6 +48,10 @@ module Datadog
47
48
 
48
49
  private
49
50
 
51
+ def datadog_integration
52
+ CI::Contrib::Instrumentation.fetch_integration(:rspec)
53
+ end
54
+
50
55
  def datadog_configuration
51
56
  Datadog.configuration.ci[:rspec]
52
57
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
3
+ require_relative "../patcher"
4
4
 
5
5
  require_relative "ext"
6
6
  require_relative "rum"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
3
+ require_relative "../patcher"
4
4
 
5
5
  require_relative "ext"
6
6
  require_relative "rum"
@@ -9,28 +9,24 @@ module Datadog
9
9
  module Contrib
10
10
  module Selenium
11
11
  # Description of Selenium integration
12
- class Integration
13
- include Datadog::CI::Contrib::Integration
14
-
12
+ class Integration < Contrib::Integration
15
13
  MINIMUM_VERSION = Gem::Version.new("4.0.0")
16
14
 
17
- register_as :selenium
18
-
19
- def self.version
15
+ def version
20
16
  Gem.loaded_specs["selenium-webdriver"]&.version
21
17
  end
22
18
 
23
- def self.loaded?
19
+ def loaded?
24
20
  !defined?(::Selenium).nil? && !defined?(::Selenium::WebDriver).nil? &&
25
21
  !defined?(::Selenium::WebDriver::Driver).nil?
26
22
  end
27
23
 
28
- def self.compatible?
24
+ def compatible?
29
25
  super && version >= MINIMUM_VERSION
30
26
  end
31
27
 
32
- # additional instrumentations for test helpers are auto instrumented on test session start
33
- def auto_instrument?
28
+ # additional instrumentations for test libraries are late instrumented on test session start
29
+ def late_instrument?
34
30
  true
35
31
  end
36
32
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
3
+ require_relative "../patcher"
4
4
 
5
5
  require_relative "ext"
6
6
  require_relative "../../ext/test"
@@ -43,7 +43,7 @@ module Datadog
43
43
  active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER, "selenium")
44
44
  active_test.set_tag(
45
45
  CI::Ext::Test::TAG_BROWSER_DRIVER_VERSION,
46
- Integration.version
46
+ datadog_integration.version
47
47
  )
48
48
  active_test.set_tag(
49
49
  CI::Ext::Test::TAG_BROWSER_NAME,
@@ -63,6 +63,10 @@ module Datadog
63
63
 
64
64
  private
65
65
 
66
+ def datadog_integration
67
+ CI::Contrib::Instrumentation.fetch_integration(:selenium)
68
+ end
69
+
66
70
  def datadog_configuration
67
71
  Datadog.configuration.ci[:selenium]
68
72
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
3
+ require_relative "../patcher"
4
4
 
5
5
  require_relative "capybara_driver"
6
6
  require_relative "driver"
@@ -12,14 +12,10 @@ module Datadog
12
12
  module Selenium
13
13
  # Patcher enables patching of 'Selenium::WebDriver' module.
14
14
  module Patcher
15
- include Datadog::Tracing::Contrib::Patcher
15
+ include Datadog::CI::Contrib::Patcher
16
16
 
17
17
  module_function
18
18
 
19
- def target_version
20
- Integration.version
21
- end
22
-
23
19
  def patch
24
20
  ::Selenium::WebDriver::Driver.include(Driver)
25
21
  ::Selenium::WebDriver::Navigation.include(Navigation)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
4
-
5
3
  require_relative "ext"
6
4
  require_relative "../../ext/test"
7
5
  require_relative "../../utils/parsing"
@@ -9,27 +9,23 @@ module Datadog
9
9
  module Contrib
10
10
  module Simplecov
11
11
  # Description of Simplecov integration
12
- class Integration
13
- include Datadog::CI::Contrib::Integration
14
-
12
+ class Integration < Contrib::Integration
15
13
  MINIMUM_VERSION = Gem::Version.new("0.18.0")
16
14
 
17
- register_as :simplecov
18
-
19
- def self.version
15
+ def version
20
16
  Gem.loaded_specs["simplecov"]&.version
21
17
  end
22
18
 
23
- def self.loaded?
19
+ def loaded?
24
20
  !defined?(::SimpleCov).nil?
25
21
  end
26
22
 
27
- def self.compatible?
23
+ def compatible?
28
24
  super && version >= MINIMUM_VERSION
29
25
  end
30
26
 
31
- # additional instrumentations for test helpers are auto instrumented on test session start
32
- def auto_instrument?
27
+ # additional instrumentations for test libraries are late instrumented on test session start
28
+ def late_instrument?
33
29
  true
34
30
  end
35
31
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "datadog/tracing/contrib/patcher"
3
+ require_relative "../patcher"
4
4
 
5
5
  require_relative "result_extractor"
6
6
 
@@ -10,14 +10,10 @@ module Datadog
10
10
  module Simplecov
11
11
  # Patcher enables patching of 'SimpleCov' module.
12
12
  module Patcher
13
- include Datadog::Tracing::Contrib::Patcher
13
+ include Datadog::CI::Contrib::Patcher
14
14
 
15
15
  module_function
16
16
 
17
- def target_version
18
- Integration.version
19
- end
20
-
21
17
  def patch
22
18
  ::SimpleCov.include(ResultExtractor)
23
19
  end
@@ -17,6 +17,11 @@ module Datadog
17
17
  get_tag(Ext::Test::TAG_NAME)
18
18
  end
19
19
 
20
+ # @return [String] the test id according to Datadog's test impact analysis.
21
+ def datadog_test_id
22
+ @datadog_test_id ||= Utils::TestRun.datadog_test_id(name, test_suite_name, parameters)
23
+ end
24
+
20
25
  # Finishes the current test.
21
26
  # @return [void]
22
27
  def finish
@@ -140,22 +145,18 @@ module Datadog
140
145
 
141
146
  # @internal
142
147
  def any_retry_passed?
143
- !!test_suite&.any_test_retry_passed?(test_id)
148
+ !!test_suite&.any_test_retry_passed?(datadog_test_id)
144
149
  end
145
150
 
146
151
  private
147
152
 
148
- def test_id
149
- @test_id ||= Utils::TestRun.datadog_test_id(name, test_suite_name, parameters)
150
- end
151
-
152
153
  def record_test_result(datadog_status)
153
154
  # if this test was already executed in this test suite, mark it as retried
154
- if test_suite&.test_executed?(test_id)
155
+ if test_suite&.test_executed?(datadog_test_id)
155
156
  set_tag(Ext::Test::TAG_IS_RETRY, "true")
156
157
  end
157
158
 
158
- test_suite&.record_test_result(test_id, datadog_status)
159
+ test_suite&.record_test_result(datadog_test_id, datadog_status)
159
160
  end
160
161
  end
161
162
  end
@@ -144,11 +144,16 @@ module Datadog
144
144
  event
145
145
  end
146
146
 
147
+ def skippable?(test)
148
+ return false if !enabled? || !skipping_tests?
149
+
150
+ @skippable_tests.include?(test.datadog_test_id)
151
+ end
152
+
147
153
  def mark_if_skippable(test)
148
154
  return if !enabled? || !skipping_tests?
149
155
 
150
- datadog_test_id = Utils::TestRun.datadog_test_id(test.name, test.test_suite_name, test.parameters)
151
- if @skippable_tests.include?(datadog_test_id)
156
+ if skippable?(test)
152
157
  if forked?
153
158
  Datadog.logger.warn { "Intelligent test runner is not supported for forking test runners yet" }
154
159
  return
@@ -156,9 +161,9 @@ module Datadog
156
161
 
157
162
  test.set_tag(Ext::Test::TAG_ITR_SKIPPED_BY_ITR, "true")
158
163
 
159
- Datadog.logger.debug { "Marked test as skippable: #{datadog_test_id}" }
164
+ Datadog.logger.debug { "Marked test as skippable: #{test.datadog_test_id}" }
160
165
  else
161
- Datadog.logger.debug { "Test is not skippable: #{datadog_test_id}" }
166
+ Datadog.logger.debug { "Test is not skippable: #{test.datadog_test_id}" }
162
167
  end
163
168
  end
164
169
 
@@ -101,7 +101,7 @@ module Datadog
101
101
  end
102
102
  @total_limit = (tests_count * percentage_limit / 100.0).ceil
103
103
  Datadog.logger.debug do
104
- "Retry new tests total limit is [#{@total_limit}] (#{percentage_limit}%) of #{tests_count}"
104
+ "Retry new tests total limit is [#{@total_limit}] (#{percentage_limit}% of #{tests_count})"
105
105
  end
106
106
  end
107
107
 
@@ -7,7 +7,7 @@ require_relative "telemetry"
7
7
  require_relative "total_coverage"
8
8
 
9
9
  require_relative "../codeowners/parser"
10
- require_relative "../contrib/contrib"
10
+ require_relative "../contrib/instrumentation"
11
11
  require_relative "../ext/test"
12
12
  require_relative "../git/local_repository"
13
13
 
@@ -149,7 +149,7 @@ module Datadog
149
149
  git_tree_upload_worker.perform(test_session.git_repository_url)
150
150
 
151
151
  # finds and instruments additional test libraries that we support (ex: selenium-webdriver)
152
- Contrib.auto_instrument_on_session_start!
152
+ Contrib::Instrumentation.instrument_on_session_start
153
153
 
154
154
  # sends internal telemetry events
155
155
  Telemetry.test_session_started(test_session)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../contrib/instrumentation"
3
4
  require_relative "../ext/app_types"
4
5
  require_relative "../ext/environment"
5
6
  require_relative "../ext/telemetry"
@@ -33,7 +34,7 @@ module Datadog
33
34
  Ext::Telemetry::METRIC_TEST_SESSION,
34
35
  1,
35
36
  {
36
- Ext::Telemetry::TAG_AUTO_INJECTED => "false", # ruby doesn't support auto injection yet
37
+ Ext::Telemetry::TAG_AUTO_INJECTED => Contrib::Instrumentation.auto_instrumented?.to_s,
37
38
  Ext::Telemetry::TAG_PROVIDER => test_session.ci_provider || Ext::Telemetry::Provider::UNSUPPORTED
38
39
  }
39
40
  )
@@ -4,8 +4,8 @@ module Datadog
4
4
  module CI
5
5
  module VERSION
6
6
  MAJOR = 1
7
- MINOR = 8
8
- PATCH = 1
7
+ MINOR = 10
8
+ PATCH = 0
9
9
  PRE = nil
10
10
  BUILD = nil
11
11
  # PRE and BUILD above are modified for dev gems during gem build GHA workflow
data/lib/datadog/ci.rb CHANGED
@@ -406,9 +406,17 @@ module Datadog
406
406
  end
407
407
 
408
408
  # Integrations
409
+
410
+ # Test frameworks (manual instrumentation)
409
411
  require_relative "ci/contrib/cucumber/integration"
410
- require_relative "ci/contrib/rspec/integration"
411
412
  require_relative "ci/contrib/minitest/integration"
413
+ require_relative "ci/contrib/rspec/integration"
414
+
415
+ # Test runners (instrumented automatically when corresponding frameworks are instrumented)
416
+ require_relative "ci/contrib/knapsack/integration"
417
+ require_relative "ci/contrib/ciqueue/integration"
418
+
419
+ # Additional test libraries (auto instrumented later on test session start)
412
420
  require_relative "ci/contrib/selenium/integration"
413
421
  require_relative "ci/contrib/simplecov/integration"
414
422