datadog-ci 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -2
  3. data/lib/datadog/ci/configuration/components.rb +27 -15
  4. data/lib/datadog/ci/configuration/settings.rb +12 -0
  5. data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +5 -2
  6. data/lib/datadog/ci/contrib/minitest/helpers.rb +26 -0
  7. data/lib/datadog/ci/contrib/minitest/runnable.rb +1 -19
  8. data/lib/datadog/ci/contrib/minitest/runner.rb +9 -5
  9. data/lib/datadog/ci/contrib/minitest/test.rb +5 -12
  10. data/lib/datadog/ci/contrib/rspec/example.rb +3 -3
  11. data/lib/datadog/ci/contrib/rspec/runner.rb +1 -1
  12. data/lib/datadog/ci/ext/app_types.rb +1 -1
  13. data/lib/datadog/ci/ext/settings.rb +2 -0
  14. data/lib/datadog/ci/ext/telemetry.rb +17 -5
  15. data/lib/datadog/ci/ext/test.rb +42 -4
  16. data/lib/datadog/ci/ext/transport.rb +6 -0
  17. data/lib/datadog/ci/remote/component.rb +11 -1
  18. data/lib/datadog/ci/remote/library_settings.rb +31 -0
  19. data/lib/datadog/ci/remote/library_settings_client.rb +2 -1
  20. data/lib/datadog/ci/span.rb +4 -0
  21. data/lib/datadog/ci/test.rb +67 -9
  22. data/lib/datadog/ci/test_management/component.rb +61 -0
  23. data/lib/datadog/ci/test_management/null_component.rb +25 -0
  24. data/lib/datadog/ci/test_management/tests_properties.rb +128 -0
  25. data/lib/datadog/ci/test_optimisation/component.rb +9 -30
  26. data/lib/datadog/ci/test_optimisation/skippable_percentage/base.rb +4 -0
  27. data/lib/datadog/ci/test_optimisation/skippable_percentage/calculator.rb +3 -3
  28. data/lib/datadog/ci/test_retries/component.rb +37 -7
  29. data/lib/datadog/ci/test_retries/driver/base.rb +5 -0
  30. data/lib/datadog/ci/test_retries/driver/retry_failed.rb +4 -0
  31. data/lib/datadog/ci/test_retries/driver/retry_flaky_fixed.rb +38 -0
  32. data/lib/datadog/ci/test_retries/driver/retry_new.rb +2 -7
  33. data/lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb +43 -0
  34. data/lib/datadog/ci/test_retries/strategy/retry_new.rb +5 -47
  35. data/lib/datadog/ci/test_session.rb +1 -1
  36. data/lib/datadog/ci/test_suite.rb +39 -2
  37. data/lib/datadog/ci/test_visibility/capabilities.rb +36 -0
  38. data/lib/datadog/ci/test_visibility/component.rb +127 -13
  39. data/lib/datadog/ci/test_visibility/context.rb +26 -17
  40. data/lib/datadog/ci/{test_retries/unique_tests_client.rb → test_visibility/known_tests.rb} +10 -10
  41. data/lib/datadog/ci/test_visibility/null_component.rb +4 -1
  42. data/lib/datadog/ci/test_visibility/serializers/factories/test_level.rb +1 -1
  43. data/lib/datadog/ci/test_visibility/store/global.rb +7 -0
  44. data/lib/datadog/ci/test_visibility/telemetry.rb +11 -2
  45. data/lib/datadog/ci/test_visibility/transport.rb +15 -2
  46. data/lib/datadog/ci/version.rb +1 -1
  47. data/lib/datadog/ci.rb +14 -6
  48. metadata +25 -5
@@ -59,6 +59,13 @@ module Datadog
59
59
  end
60
60
  end
61
61
 
62
+ def stop_all_test_suites
63
+ @mutex.synchronize do
64
+ @test_suites.each_value(&:finish)
65
+ @test_suites.clear
66
+ end
67
+ end
68
+
62
69
  def inheritable_session_tags
63
70
  @mutex.synchronize do
64
71
  test_session = @test_session
@@ -54,8 +54,11 @@ module Datadog
54
54
  # codeowner tag
55
55
  tags[Ext::Telemetry::TAG_HAS_CODEOWNER] = "true" if span.get_tag(Ext::Test::TAG_CODEOWNERS)
56
56
 
57
- # set is_retry tag if span represents a retried test
58
- tags[Ext::Telemetry::TAG_IS_RETRY] = "true" if span.get_tag(Ext::Test::TAG_IS_RETRY)
57
+ # set is_retry and retry_reason tags if span represents a retried test
58
+ if span.get_tag(Ext::Test::TAG_IS_RETRY)
59
+ tags[Ext::Telemetry::TAG_IS_RETRY] = "true"
60
+ tags[Ext::Telemetry::TAG_RETRY_REASON] = span.get_tag(Ext::Test::TAG_RETRY_REASON)
61
+ end
59
62
 
60
63
  # is_new
61
64
  tags[Ext::Telemetry::TAG_IS_NEW] = "true" if span.get_tag(Ext::Test::TAG_IS_NEW)
@@ -66,6 +69,12 @@ module Datadog
66
69
  tags[Ext::Telemetry::TAG_EARLY_FLAKE_DETECTION_ABORT_REASON] = early_flake_detection_abort_reason
67
70
  end
68
71
 
72
+ # test management tags
73
+ tags[Ext::Telemetry::TAG_IS_ATTEMPT_TO_FIX] = "true" if span.get_tag(Ext::Test::TAG_IS_ATTEMPT_TO_FIX)
74
+ tags[Ext::Telemetry::TAG_IS_QUARANTINED] = "true" if span.get_tag(Ext::Test::TAG_IS_QUARANTINED)
75
+ tags[Ext::Telemetry::TAG_IS_TEST_DISABLED] = "true" if span.get_tag(Ext::Test::TAG_IS_TEST_DISABLED)
76
+ tags[Ext::Telemetry::TAG_HAS_FAILED_ALL_RETRIES] = "true" if span.get_tag(Ext::Test::TAG_HAS_FAILED_ALL_RETRIES)
77
+
69
78
  tags
70
79
  end
71
80
 
@@ -4,12 +4,15 @@ require "datadog/core/environment/identity"
4
4
  require "datadog/core/telemetry/logging"
5
5
  require "datadog/core/utils/only_once"
6
6
 
7
+ require_relative "capabilities"
7
8
  require_relative "serializers/factories/test_level"
9
+
8
10
  require_relative "../ext/app_types"
9
11
  require_relative "../ext/telemetry"
10
12
  require_relative "../ext/transport"
11
13
  require_relative "../transport/event_platform_transport"
12
14
  require_relative "../transport/telemetry"
15
+ require_relative "../utils/configuration"
13
16
 
14
17
  module Datadog
15
18
  module CI
@@ -114,12 +117,22 @@ module Datadog
114
117
  packer.write("library_version")
115
118
  packer.write(Datadog::CI::VERSION::STRING)
116
119
 
120
+ library_capabilities_tags = Capabilities.tags
121
+
117
122
  Ext::AppTypes::CI_SPAN_TYPES.each do |ci_span_type|
118
123
  packer.write(ci_span_type)
119
- packer.write_map_header(1)
124
+ packer.write_map_header(2 + library_capabilities_tags.count)
120
125
 
121
- packer.write(Ext::Test::METADATA_TAG_TEST_SESSION_NAME)
126
+ packer.write(Ext::Test::TAG_TEST_SESSION_NAME)
122
127
  packer.write(test_visibility&.logical_test_session_name)
128
+
129
+ packer.write(Ext::Test::TAG_USER_PROVIDED_TEST_SERVICE)
130
+ packer.write(Utils::Configuration.service_name_provided_by_user?.to_s)
131
+
132
+ library_capabilities_tags.each do |tag, value|
133
+ packer.write(tag)
134
+ packer.write(value)
135
+ end
123
136
  end
124
137
 
125
138
  packer.write("events")
@@ -4,7 +4,7 @@ module Datadog
4
4
  module CI
5
5
  module VERSION
6
6
  MAJOR = 1
7
- MINOR = 12
7
+ MINOR = 14
8
8
  PATCH = 0
9
9
  PRE = nil
10
10
  BUILD = nil
data/lib/datadog/ci.rb CHANGED
@@ -10,7 +10,7 @@ require "datadog"
10
10
  require "datadog/core"
11
11
 
12
12
  module Datadog
13
- # Datadog CI visibility public API.
13
+ # Datadog Test Optimization public API.
14
14
  #
15
15
  # @public_api
16
16
  module CI
@@ -49,7 +49,7 @@ module Datadog
49
49
  1,
50
50
  {Ext::Telemetry::TAG_EVENT_TYPE => Ext::Telemetry::EventType::SESSION}
51
51
  )
52
- test_visibility.start_test_session(service: service, tags: tags, total_tests_count: total_tests_count)
52
+ test_visibility.start_test_session(service: service, tags: tags, estimated_total_tests_count: total_tests_count)
53
53
  end
54
54
 
55
55
  # The active, unfinished test session.
@@ -319,16 +319,16 @@ module Datadog
319
319
  # @return [Object] If a block is provided, returns the result of the block execution.
320
320
  # @return [Datadog::CI::Span] If no block is provided, returns the active,
321
321
  # unfinished {Datadog::CI::Span}.
322
- # @return [nil] if CI visibility is disabled
323
- # @raise [ReservedTypeError] if provided type is reserved for Datadog CI visibility
322
+ # @return [nil] if Test Optimization is disabled
323
+ # @raise [ReservedTypeError] if provided type is reserved for Datadog Test Optimization
324
324
  # @yield Optional block where newly created {Datadog::CI::Span} captures the execution.
325
325
  # @yieldparam [Datadog::CI::Span] ci_span the newly created and active [Datadog::CI::Span]
326
- # @yieldparam [nil] ci_span if CI visibility is disabled
326
+ # @yieldparam [nil] ci_span if Test Optimization is disabled
327
327
  def trace(span_name, type: "span", tags: {}, &block)
328
328
  if Ext::AppTypes::CI_SPAN_TYPES.include?(type)
329
329
  raise(
330
330
  ReservedTypeError,
331
- "Span type #{type} is reserved for Datadog CI visibility. " \
331
+ "Span type #{type} is reserved for Datadog Test Optimization. " \
332
332
  "Reserved types are: #{Ext::AppTypes::CI_SPAN_TYPES}"
333
333
  )
334
334
  end
@@ -401,6 +401,14 @@ module Datadog
401
401
  def test_optimisation
402
402
  components.test_optimisation
403
403
  end
404
+
405
+ def test_management
406
+ components.test_management
407
+ end
408
+
409
+ def test_retries
410
+ components.test_retries
411
+ end
404
412
  end
405
413
  end
406
414
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-23 00:00:00.000000000 Z
10
+ date: 2025-03-11 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: datadog
@@ -37,8 +37,22 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: drb
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  description: |2
41
- datadog-ci is a Datadog's CI visibility library for Ruby. It traces
55
+ datadog-ci is a Datadog's Test Optimization library for Ruby. It traces
42
56
  tests as they are being executed and brings developers visibility into
43
57
  their CI pipelines.
44
58
  email:
@@ -164,6 +178,9 @@ files:
164
178
  - lib/datadog/ci/remote/slow_test_retries.rb
165
179
  - lib/datadog/ci/span.rb
166
180
  - lib/datadog/ci/test.rb
181
+ - lib/datadog/ci/test_management/component.rb
182
+ - lib/datadog/ci/test_management/null_component.rb
183
+ - lib/datadog/ci/test_management/tests_properties.rb
167
184
  - lib/datadog/ci/test_module.rb
168
185
  - lib/datadog/ci/test_optimisation/component.rb
169
186
  - lib/datadog/ci/test_optimisation/coverage/ddcov.rb
@@ -179,18 +196,21 @@ files:
179
196
  - lib/datadog/ci/test_retries/driver/base.rb
180
197
  - lib/datadog/ci/test_retries/driver/no_retry.rb
181
198
  - lib/datadog/ci/test_retries/driver/retry_failed.rb
199
+ - lib/datadog/ci/test_retries/driver/retry_flaky_fixed.rb
182
200
  - lib/datadog/ci/test_retries/driver/retry_new.rb
183
201
  - lib/datadog/ci/test_retries/null_component.rb
184
202
  - lib/datadog/ci/test_retries/strategy/base.rb
185
203
  - lib/datadog/ci/test_retries/strategy/no_retry.rb
186
204
  - lib/datadog/ci/test_retries/strategy/retry_failed.rb
205
+ - lib/datadog/ci/test_retries/strategy/retry_flaky_fixed.rb
187
206
  - lib/datadog/ci/test_retries/strategy/retry_new.rb
188
- - lib/datadog/ci/test_retries/unique_tests_client.rb
189
207
  - lib/datadog/ci/test_session.rb
190
208
  - lib/datadog/ci/test_suite.rb
209
+ - lib/datadog/ci/test_visibility/capabilities.rb
191
210
  - lib/datadog/ci/test_visibility/component.rb
192
211
  - lib/datadog/ci/test_visibility/context.rb
193
212
  - lib/datadog/ci/test_visibility/flush.rb
213
+ - lib/datadog/ci/test_visibility/known_tests.rb
194
214
  - lib/datadog/ci/test_visibility/null_component.rb
195
215
  - lib/datadog/ci/test_visibility/null_transport.rb
196
216
  - lib/datadog/ci/test_visibility/serializers/base.rb
@@ -254,5 +274,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
274
  requirements: []
255
275
  rubygems_version: 3.6.2
256
276
  specification_version: 4
257
- summary: Datadog CI visibility for your ruby application
277
+ summary: Datadog Test Optimization for your ruby application
258
278
  test_files: []