datadog-ci 1.0.0.beta1 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +105 -60
- data/README.md +37 -46
- data/lib/datadog/ci/configuration/components.rb +51 -9
- data/lib/datadog/ci/configuration/settings.rb +6 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +10 -5
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +3 -0
- data/lib/datadog/ci/contrib/cucumber/step.rb +27 -0
- data/lib/datadog/ci/contrib/minitest/patcher.rb +2 -2
- data/lib/datadog/ci/contrib/minitest/test.rb +105 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +11 -5
- data/lib/datadog/ci/ext/environment/providers/local_git.rb +8 -79
- data/lib/datadog/ci/ext/environment.rb +11 -16
- data/lib/datadog/ci/ext/settings.rb +1 -0
- data/lib/datadog/ci/ext/test.rb +8 -1
- data/lib/datadog/ci/ext/transport.rb +8 -0
- data/lib/datadog/ci/git/local_repository.rb +238 -0
- data/lib/datadog/ci/git/packfiles.rb +70 -0
- data/lib/datadog/ci/git/search_commits.rb +77 -0
- data/lib/datadog/ci/git/tree_uploader.rb +90 -0
- data/lib/datadog/ci/git/upload_packfile.rb +66 -0
- data/lib/datadog/ci/git/user.rb +29 -0
- data/lib/datadog/ci/itr/coverage/event.rb +18 -1
- data/lib/datadog/ci/itr/coverage/writer.rb +114 -0
- data/lib/datadog/ci/itr/runner.rb +134 -11
- data/lib/datadog/ci/itr/skippable.rb +108 -0
- data/lib/datadog/ci/span.rb +16 -0
- data/lib/datadog/ci/test.rb +37 -12
- data/lib/datadog/ci/test_module.rb +2 -2
- data/lib/datadog/ci/test_session.rb +2 -2
- data/lib/datadog/ci/test_suite.rb +2 -2
- data/lib/datadog/ci/test_visibility/null_recorder.rb +4 -1
- data/lib/datadog/ci/test_visibility/recorder.rb +47 -9
- data/lib/datadog/ci/test_visibility/serializers/base.rb +3 -2
- data/lib/datadog/ci/test_visibility/serializers/factories/test_level.rb +3 -3
- data/lib/datadog/ci/test_visibility/serializers/factories/test_suite_level.rb +6 -6
- data/lib/datadog/ci/test_visibility/serializers/test_v2.rb +14 -2
- data/lib/datadog/ci/test_visibility/transport.rb +6 -2
- data/lib/datadog/ci/transport/http.rb +24 -4
- data/lib/datadog/ci/transport/remote_settings_api.rb +14 -6
- data/lib/datadog/ci/utils/configuration.rb +2 -2
- data/lib/datadog/ci/utils/git.rb +6 -67
- data/lib/datadog/ci/utils/parsing.rb +16 -0
- data/lib/datadog/ci/utils/test_run.rb +25 -0
- data/lib/datadog/ci/version.rb +1 -1
- data/lib/datadog/ci/worker.rb +35 -0
- data/lib/datadog/ci.rb +4 -0
- metadata +17 -6
- data/lib/datadog/ci/contrib/minitest/hooks.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335897204d48926d8c0e3ab1ef8e7c6247a88b12627e27e021614f1b368ab788
|
4
|
+
data.tar.gz: db5b4ac716d7e0f28712cb7fef86c1f438f2a8b5fa28af0bb67ef91d3758d1c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ebd289964298131bed28406316a48992aaec8e54a6fb21f58ffb6c3d2c523f49fbc5aedf83c9f72a5b8ba45c54cce6df46b8d83eae6ce42804a8901954b61c
|
7
|
+
data.tar.gz: dd1fcd1c56179c0ab933d166801f69cb843efe67449ad69e7491ee674ff3325fcb9b1adb814881a80137d24de6fa264103ad02d71b73c814acf84a56b706a707
|
data/CHANGELOG.md
CHANGED
@@ -1,101 +1,129 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.0.0.beta3] - 2024-04-30
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- "why this test was skipped" feature ([#165])
|
8
|
+
- custom configurations tags support for ITR ([#166])
|
9
|
+
- unskippable tests for ITR ([#167])
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- additional debug logging, do not skip tests when running in forked processes ([#168])
|
14
|
+
|
15
|
+
## [1.0.0.beta2] - 2024-04-23
|
16
|
+
|
17
|
+
### Added
|
18
|
+
|
19
|
+
- Code coverage events writer ([#150])
|
20
|
+
- Git tree upload - git command line integration ([#151])
|
21
|
+
- Add Git::SearchCommits api client ([#152])
|
22
|
+
- Upload packfiles API client ([#153])
|
23
|
+
- Git tree uploader ([#154])
|
24
|
+
- Git repository unshallowing logic ([#155])
|
25
|
+
- Git upload async worker ([#156])
|
26
|
+
- Reduce ITR-induced code coverage overhead for default branch ([#157])
|
27
|
+
- Skippable tests api client ([#158])
|
28
|
+
- Request skippable tests when configuring ITR ([#159])
|
29
|
+
- Test skipping implementation ([#160])
|
30
|
+
|
3
31
|
## [1.0.0.beta1] - 2024-03-25
|
4
32
|
|
5
33
|
### Added
|
6
34
|
|
7
|
-
|
8
|
-
|
35
|
+
- datadog-cov native extension for per test code coverage ([#137])
|
36
|
+
- citestcov transport to serialize and send code coverage events ([#148])
|
9
37
|
|
10
38
|
### Removed
|
11
39
|
|
12
|
-
|
40
|
+
- Ruby 2.1-2.6 support is dropped
|
13
41
|
|
14
42
|
## [0.8.3] - 2024-03-20
|
15
43
|
|
16
44
|
### Fixed
|
17
45
|
|
18
|
-
|
46
|
+
- fix: cucumber-ruby 9.2 includes breaking change for Cucumber::Core::Test::Result ([#145][])
|
19
47
|
|
20
48
|
### Changed
|
21
49
|
|
22
|
-
|
23
|
-
|
50
|
+
- remove temporary hack and use Core::Remote::Negotiation's new constructor param ([#142][])
|
51
|
+
- use filter_basic_auth method from Datadog::Core ([#141][])
|
24
52
|
|
25
53
|
## [0.8.2] - 2024-03-19
|
26
54
|
|
27
55
|
### Fixed
|
28
56
|
|
29
|
-
|
57
|
+
- assign the single running test suite for a test if none found by test suite name ([#139][])
|
30
58
|
|
31
59
|
## [0.8.1] - 2024-03-12
|
32
60
|
|
33
61
|
### Fixed
|
34
62
|
|
35
|
-
|
63
|
+
- fix minitest instrumentation with mixins ([#134][])
|
36
64
|
|
37
65
|
## [0.8.0] - 2024-03-08
|
38
66
|
|
39
67
|
### Added
|
40
68
|
|
41
|
-
|
69
|
+
- gzip agent payloads support via evp_proxy/v4 ([#123][])
|
42
70
|
|
43
71
|
### Changed
|
44
72
|
|
45
|
-
|
73
|
+
- Add note to README on using VCR ([#122][])
|
46
74
|
|
47
75
|
### Fixed
|
48
76
|
|
49
|
-
|
77
|
+
- use framework name as test module name to make test fingerprints stable ([#131][])
|
50
78
|
|
51
79
|
## [0.7.0] - 2024-01-26
|
52
80
|
|
53
81
|
### Added
|
54
82
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
83
|
+
- Source code integration ([#95][])
|
84
|
+
- CODEOWNERS support ([#98][])
|
85
|
+
- Cucumber scenarios with examples are treated as parametrized tests ([#100][])
|
86
|
+
- Deduplicate dynamically generated RSpec examples using test.parameters ([#101][])
|
87
|
+
- Repository name is used as default test service name ([#104][])
|
88
|
+
- Cucumber v9 support ([#99][])
|
89
|
+
- ci-queue runner support for minitest ([#110][])
|
90
|
+
- ci-queue support for rspec ([#112][])
|
63
91
|
|
64
92
|
### Fixed
|
65
93
|
|
66
|
-
|
67
|
-
|
68
|
-
|
94
|
+
- do not publish sig folder when publishing this gem to prevent steep errors in client applications ([#114][])
|
95
|
+
- minitest: fix rails parallel test runner ([#115][])
|
96
|
+
- Test suites and tests skipped by frameworks are correctly reported as skipped to Datadog ([#113][])
|
69
97
|
|
70
98
|
### Changed
|
71
99
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
100
|
+
- Enable test suite level visibility by default (with killswitch) ([#109][])
|
101
|
+
- Test suite names are more human-readable now ([#105][])
|
102
|
+
- Remove span_type method in tracer-related models ([#107][])
|
103
|
+
- Manual tracing API: convert type parameter to keyword in Datadog::CI.trace, remove internal-only methods from public API ([#108][])
|
76
104
|
|
77
105
|
## [0.6.0] - 2024-01-03
|
78
106
|
|
79
107
|
### Added
|
80
108
|
|
81
|
-
|
82
|
-
|
83
|
-
|
109
|
+
- Test suite level visibility instrumentation for RSpec ([#86][])
|
110
|
+
- Test suite level visibility instrumentation for Cucumber ([#90][])
|
111
|
+
- Test suite level visibility instrumentation for Minitest framework ([#92][])
|
84
112
|
|
85
113
|
### Fixed
|
86
114
|
|
87
|
-
|
115
|
+
- Do not instantiate TestVisibility::Recorder unless CI visibility is enabled ([#89][])
|
88
116
|
|
89
117
|
## [0.5.1] - 2023-12-11
|
90
118
|
|
91
119
|
### Fixed
|
92
120
|
|
93
|
-
|
121
|
+
- do not collect environment tags when CI is not enabled ([#87][])
|
94
122
|
|
95
123
|
### Changed
|
96
124
|
|
97
|
-
|
98
|
-
|
125
|
+
- Move private classes and modules deeper in module hierarchy ([#85][])
|
126
|
+
- update appraisal dependencies ([#84][])
|
99
127
|
|
100
128
|
## [0.5.0] - 2023-12-06
|
101
129
|
|
@@ -107,98 +135,100 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
107
135
|
|
108
136
|
### Added
|
109
137
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
138
|
+
- Test suite level visibility: add test session public API ([#72][])
|
139
|
+
- Test suite level visibility: test module support ([#76][])
|
140
|
+
- Test suite level visibility: test suites support ([#77][])
|
141
|
+
- add YARD documentation ([#82][])
|
142
|
+
- support validation errors for CI spans ([#78][])
|
115
143
|
|
116
144
|
### Changed
|
117
145
|
|
118
|
-
|
119
|
-
|
146
|
+
- Validate DD_SITE variable ([#79][])
|
147
|
+
- Document how to use WebMock with datadog-ci ([#80][])
|
120
148
|
|
121
149
|
### Fixed
|
122
150
|
|
123
|
-
|
124
|
-
|
151
|
+
- Datadog::CI.trace_test always starts a new trace ([#74][])
|
152
|
+
- Skip tracing when CI mode disabled and manual API is used ([#75][])
|
125
153
|
|
126
154
|
### Removed
|
127
155
|
|
128
|
-
|
156
|
+
- Deprecate operation name setting, change service_name to service in public API ([#81][])
|
129
157
|
|
130
158
|
## [0.4.1] - 2023-11-22
|
131
159
|
|
132
160
|
### Fixed
|
133
161
|
|
134
|
-
|
162
|
+
- disable 128-bit trace id generation in CI mode ([#70][])
|
135
163
|
|
136
164
|
## [0.4.0] - 2023-11-21
|
137
165
|
|
138
166
|
### Added
|
139
167
|
|
140
|
-
|
168
|
+
- Public API for manual test instrumentation ([#64][]) ([#61][])
|
141
169
|
|
142
170
|
### Changed
|
143
171
|
|
144
|
-
|
172
|
+
- fix tracing instrumentation example in readme ([#60][])
|
145
173
|
|
146
174
|
### Fixed
|
147
175
|
|
148
|
-
|
176
|
+
- Remove user credentials from ssh URLs and from GITHUB_REPO_URL environment variable ([#66][])
|
149
177
|
|
150
178
|
### Removed
|
151
179
|
|
152
|
-
|
180
|
+
- Remove _dd.measured tag from spans ([#65][])
|
153
181
|
|
154
182
|
## [0.3.0] - 2023-10-25
|
155
183
|
|
156
184
|
### Added
|
157
185
|
|
158
|
-
|
159
|
-
|
186
|
+
- Add AWS CodePipeline support for automatic CI tags extraction ([#54][])
|
187
|
+
- Support test visibility protocol via Datadog Agent with EVP proxy ([#51][])
|
160
188
|
|
161
189
|
### Changed
|
162
190
|
|
163
|
-
|
191
|
+
- Migrate to Net::HTTP adapter from Core module of ddtrace gem ([#49][])
|
164
192
|
|
165
193
|
## [0.2.0] - 2023-10-05
|
166
194
|
|
167
195
|
### Added
|
168
196
|
|
169
|
-
|
197
|
+
- [CIAPP-2959] Agentless mode ([#33][])
|
170
198
|
|
171
199
|
### Fixed
|
172
200
|
|
173
|
-
|
201
|
+
- [CIAPP-4278] Fix an issue with emojis in commit message breaking LocalGit tags provider ([#40][])
|
174
202
|
|
175
203
|
## [0.1.1] - 2023-09-14
|
176
204
|
|
177
205
|
### Fixed
|
178
206
|
|
179
|
-
|
207
|
+
- Fix circular dependencies warnings ([#31][])
|
180
208
|
|
181
209
|
## 0.1.0 - 2023-09-12
|
182
210
|
|
183
211
|
### Added
|
184
212
|
|
185
|
-
|
186
|
-
|
187
|
-
|
213
|
+
- Add cucumber 8.0.0 support ([#7][])
|
214
|
+
- Docs: contribution documentation ([#14][], [#28][])
|
215
|
+
- Dev process: issue templates ([#20][])
|
188
216
|
|
189
217
|
### Changed
|
190
218
|
|
191
|
-
|
219
|
+
- Validate customer-supplied git tags ([#15][])
|
192
220
|
|
193
221
|
### Fixed
|
194
222
|
|
195
|
-
|
223
|
+
- Fix Datadog::CI::Environment to support the new CI specs ([#11][])
|
196
224
|
|
197
225
|
### Removed
|
198
226
|
|
199
|
-
|
227
|
+
- Ruby versions < 2.7 no longer supported ([#8][])
|
200
228
|
|
201
229
|
[Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.3...main
|
230
|
+
[1.0.0.beta3]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta2...v1.0.0.beta3
|
231
|
+
[1.0.0.beta2]: https://github.com/DataDog/datadog-ci-rb/compare/v1.0.0.beta1...v1.0.0.beta2
|
202
232
|
[1.0.0.beta1]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.3...v1.0.0.beta1
|
203
233
|
[0.8.3]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.2...v0.8.3
|
204
234
|
[0.8.2]: https://github.com/DataDog/datadog-ci-rb/compare/v0.8.1...v0.8.2
|
@@ -276,3 +306,18 @@ Currently test suite level visibility is not used by our instrumentation: it wil
|
|
276
306
|
[#142]: https://github.com/DataDog/datadog-ci-rb/issues/142
|
277
307
|
[#145]: https://github.com/DataDog/datadog-ci-rb/issues/145
|
278
308
|
[#148]: https://github.com/DataDog/datadog-ci-rb/issues/148
|
309
|
+
[#150]: https://github.com/DataDog/datadog-ci-rb/issues/150
|
310
|
+
[#151]: https://github.com/DataDog/datadog-ci-rb/issues/151
|
311
|
+
[#152]: https://github.com/DataDog/datadog-ci-rb/issues/152
|
312
|
+
[#153]: https://github.com/DataDog/datadog-ci-rb/issues/153
|
313
|
+
[#154]: https://github.com/DataDog/datadog-ci-rb/issues/154
|
314
|
+
[#155]: https://github.com/DataDog/datadog-ci-rb/issues/155
|
315
|
+
[#156]: https://github.com/DataDog/datadog-ci-rb/issues/156
|
316
|
+
[#157]: https://github.com/DataDog/datadog-ci-rb/issues/157
|
317
|
+
[#158]: https://github.com/DataDog/datadog-ci-rb/issues/158
|
318
|
+
[#159]: https://github.com/DataDog/datadog-ci-rb/issues/159
|
319
|
+
[#160]: https://github.com/DataDog/datadog-ci-rb/issues/160
|
320
|
+
[#165]: https://github.com/DataDog/datadog-ci-rb/issues/165
|
321
|
+
[#166]: https://github.com/DataDog/datadog-ci-rb/issues/166
|
322
|
+
[#167]: https://github.com/DataDog/datadog-ci-rb/issues/167
|
323
|
+
[#168]: https://github.com/DataDog/datadog-ci-rb/issues/168
|
data/README.md
CHANGED
@@ -18,6 +18,10 @@ group :test do
|
|
18
18
|
end
|
19
19
|
```
|
20
20
|
|
21
|
+
## Upgrade from ddtrace v1.x
|
22
|
+
|
23
|
+
If you used [test visibility for Ruby](https://docs.datadoghq.com/tests/setup/ruby/) with [ddtrace](https://github.com/datadog/dd-trace-rb) gem, check out our [upgrade guide](/docs/UpgradeGuide.md).
|
24
|
+
|
21
25
|
## Usage
|
22
26
|
|
23
27
|
### RSpec
|
@@ -31,25 +35,14 @@ require 'datadog/ci'
|
|
31
35
|
# Only activates test instrumentation on CI
|
32
36
|
if ENV["DD_ENV"] == "ci"
|
33
37
|
Datadog.configure do |c|
|
34
|
-
# Configures the tracer to ensure results delivery
|
35
|
-
c.ci.enabled = true
|
36
|
-
|
37
38
|
# The name of the service or library under test
|
38
39
|
c.service = 'my-ruby-app'
|
39
|
-
|
40
|
-
|
41
|
-
c.ci.instrument :rspec, **options
|
40
|
+
c.ci.enabled = true
|
41
|
+
c.ci.instrument :rspec
|
42
42
|
end
|
43
43
|
end
|
44
44
|
```
|
45
45
|
|
46
|
-
`options` are the following keyword arguments:
|
47
|
-
|
48
|
-
| Key | Description | Default |
|
49
|
-
| --- | ----------- | ------- |
|
50
|
-
| `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
51
|
-
| `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
|
52
|
-
|
53
46
|
### Minitest
|
54
47
|
|
55
48
|
The Minitest integration will trace all executions of tests when using `minitest` test framework.
|
@@ -64,13 +57,10 @@ require 'datadog/ci'
|
|
64
57
|
if ENV["DD_ENV"] == "ci"
|
65
58
|
# Configure default Minitest integration
|
66
59
|
Datadog.configure do |c|
|
67
|
-
# Configures the tracer to ensure results delivery
|
68
|
-
c.ci.enabled = true
|
69
|
-
|
70
60
|
# The name of the service or library under test
|
71
61
|
c.service = 'my-ruby-app'
|
72
|
-
|
73
|
-
c.ci.instrument :minitest
|
62
|
+
c.ci.enabled = true
|
63
|
+
c.ci.instrument :minitest
|
74
64
|
end
|
75
65
|
end
|
76
66
|
```
|
@@ -87,20 +77,13 @@ require 'minitest/autorun'
|
|
87
77
|
|
88
78
|
if ENV["DD_ENV"] == "ci"
|
89
79
|
Datadog.configure do |c|
|
90
|
-
c.ci.enabled = true
|
91
80
|
c.service = 'my-ruby-app'
|
81
|
+
c.ci.enabled = true
|
92
82
|
c.ci.instrument :minitest
|
93
83
|
end
|
94
84
|
end
|
95
85
|
```
|
96
86
|
|
97
|
-
`options` are the following keyword arguments:
|
98
|
-
|
99
|
-
| Key | Description | Default |
|
100
|
-
| --- | ----------- | ------- |
|
101
|
-
| `enabled` | Defines whether Minitest tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
102
|
-
| `service_name` | Service name used for `minitest` instrumentation. | `'minitest'` |
|
103
|
-
|
104
87
|
### Cucumber
|
105
88
|
|
106
89
|
Activate `Cucumber` integration with configuration
|
@@ -112,24 +95,31 @@ require 'datadog/ci'
|
|
112
95
|
# Only activates test instrumentation on CI
|
113
96
|
if ENV["DD_ENV"] == "ci"
|
114
97
|
Datadog.configure do |c|
|
115
|
-
# Configures the tracer to ensure results delivery
|
116
|
-
c.ci.enabled = true
|
117
|
-
|
118
98
|
# The name of the service or library under test
|
119
99
|
c.service = 'my-ruby-app'
|
120
|
-
|
121
|
-
|
122
|
-
c.ci.instrument :cucumber, **options
|
100
|
+
c.ci.enabled = true
|
101
|
+
c.ci.instrument :cucumber
|
123
102
|
end
|
124
103
|
end
|
125
104
|
```
|
126
105
|
|
127
|
-
|
106
|
+
### Instrumentation options
|
107
|
+
|
108
|
+
Configuration `ci.instrument` accepts the following optional parameters:
|
128
109
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
110
|
+
- `enabled` (default: `true`) - defines whether tests should be traced (useful for temporarily disabling tracing)
|
111
|
+
- `service_name` - name of the service or library under test (when you want it to be different for a test framework)
|
112
|
+
|
113
|
+
Example usage:
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
Datadog.configure do |c|
|
117
|
+
c.service = 'my-ruby-app'
|
118
|
+
c.ci.enabled = true
|
119
|
+
c.ci.instrument :cucumber, service_name: 'my-cucumber-features', enabled: true
|
120
|
+
c.ci.instrument :minitest, service_name: 'my-unit-tests', enabled: false
|
121
|
+
end
|
122
|
+
```
|
133
123
|
|
134
124
|
## Agentless mode
|
135
125
|
|
@@ -154,7 +144,7 @@ or other external calls like here:
|
|
154
144
|
|
155
145
|
![Test trace with redis instrumented](./docs/screenshots/test-trace-with-redis.png)
|
156
146
|
|
157
|
-
|
147
|
+
To achieve this, add Datadog tracing instrumentations in your `Datadog.configure` block:
|
158
148
|
|
159
149
|
```ruby
|
160
150
|
Datadog.configure do |c|
|
@@ -167,13 +157,13 @@ end
|
|
167
157
|
...or enable auto instrumentation in your test_helper/spec_helper:
|
168
158
|
|
169
159
|
```ruby
|
170
|
-
require "
|
160
|
+
require "datadog/auto_instrument"
|
171
161
|
```
|
172
162
|
|
173
163
|
Note: in CI mode these traces are going to be submitted to CI Visibility,
|
174
164
|
they will **not** show up in Datadog APM.
|
175
165
|
|
176
|
-
For the full list of available instrumentations see [
|
166
|
+
For the full list of available instrumentations see [datadog documentation](https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md)
|
177
167
|
|
178
168
|
### WebMock
|
179
169
|
|
@@ -187,8 +177,7 @@ Webmock accordingly.
|
|
187
177
|
|
188
178
|
```ruby
|
189
179
|
# when using agentless mode
|
190
|
-
|
191
|
-
WebMock.disable_net_connect!(:allow => /datadoghq.com/)
|
180
|
+
WebMock.disable_net_connect!(:allow => /datadoghq/)
|
192
181
|
|
193
182
|
# when using agent
|
194
183
|
WebMock.disable_net_connect!(:allow_localhost => true)
|
@@ -211,8 +200,10 @@ VCR.configure do |config|
|
|
211
200
|
config.ignore_hosts "127.0.0.1", "localhost"
|
212
201
|
|
213
202
|
# when using agentless mode
|
214
|
-
|
215
|
-
|
203
|
+
config.ignore_request do |request|
|
204
|
+
# ignore all requests to datadoghq hosts
|
205
|
+
request.uri =~ /datadoghq/
|
206
|
+
end
|
216
207
|
end
|
217
208
|
```
|
218
209
|
|
@@ -220,7 +211,7 @@ end
|
|
220
211
|
|
221
212
|
Startup logs produce a report of tracing state when the application is initially configured.
|
222
213
|
These logs are activated by default in test mode, if you don't want them you can disable this
|
223
|
-
via `
|
214
|
+
via `DD_TRACE_STARTUP_LOGS=0` or in the `Datadog.configure` block:
|
224
215
|
|
225
216
|
```ruby
|
226
217
|
Datadog.configure { |c| c.diagnostics.startup_logs.enabled = false }
|
@@ -230,7 +221,7 @@ Datadog.configure { |c| c.diagnostics.startup_logs.enabled = false }
|
|
230
221
|
|
231
222
|
Switching the library into debug mode will produce verbose, detailed logs about tracing activity, including any suppressed errors. This output can be helpful in identifying errors, confirming trace output, or catching HTTP transport issues.
|
232
223
|
|
233
|
-
You can enable this via `
|
224
|
+
You can enable this via `DD_TRACE_DEBUG=1` or in the `Datadog.configure` block:
|
234
225
|
|
235
226
|
```ruby
|
236
227
|
Datadog.configure { |c| c.diagnostics.debug = true }
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../ext/settings"
|
4
|
+
require_relative "../git/tree_uploader"
|
4
5
|
require_relative "../itr/runner"
|
6
|
+
require_relative "../itr/coverage/transport"
|
7
|
+
require_relative "../itr/coverage/writer"
|
5
8
|
require_relative "../test_visibility/flush"
|
6
9
|
require_relative "../test_visibility/recorder"
|
7
10
|
require_relative "../test_visibility/null_recorder"
|
@@ -10,25 +13,35 @@ require_relative "../test_visibility/serializers/factories/test_suite_level"
|
|
10
13
|
require_relative "../test_visibility/transport"
|
11
14
|
require_relative "../transport/api/builder"
|
12
15
|
require_relative "../transport/remote_settings_api"
|
16
|
+
require_relative "../utils/test_run"
|
17
|
+
require_relative "../worker"
|
13
18
|
|
14
19
|
module Datadog
|
15
20
|
module CI
|
16
21
|
module Configuration
|
17
22
|
# Adds CI behavior to Datadog trace components
|
18
23
|
module Components
|
19
|
-
attr_reader :ci_recorder
|
24
|
+
attr_reader :ci_recorder, :itr
|
20
25
|
|
21
26
|
def initialize(settings)
|
22
27
|
# Activate CI mode if enabled
|
23
28
|
if settings.ci.enabled
|
24
29
|
activate_ci!(settings)
|
25
30
|
else
|
31
|
+
@itr = nil
|
26
32
|
@ci_recorder = TestVisibility::NullRecorder.new
|
27
33
|
end
|
28
34
|
|
29
35
|
super
|
30
36
|
end
|
31
37
|
|
38
|
+
def shutdown!(replacement = nil)
|
39
|
+
super
|
40
|
+
|
41
|
+
@ci_recorder&.shutdown!
|
42
|
+
@itr&.shutdown!
|
43
|
+
end
|
44
|
+
|
32
45
|
def activate_ci!(settings)
|
33
46
|
# Configure ddtrace library for CI visibility mode
|
34
47
|
# Deactivate telemetry
|
@@ -47,12 +60,22 @@ module Datadog
|
|
47
60
|
# Choose user defined TraceFlush or default to CI TraceFlush
|
48
61
|
settings.tracing.test_mode.trace_flush = settings.ci.trace_flush || CI::TestVisibility::Flush::Partial.new
|
49
62
|
|
63
|
+
# startup logs are useless for CI visibility and create noise
|
64
|
+
settings.diagnostics.startup_logs.enabled = false
|
65
|
+
|
50
66
|
# transport creation
|
51
67
|
writer_options = settings.ci.writer_options
|
68
|
+
coverage_writer = nil
|
52
69
|
test_visibility_api = build_test_visibility_api(settings)
|
53
70
|
|
54
71
|
if test_visibility_api
|
55
|
-
|
72
|
+
# setup writer for code coverage payloads
|
73
|
+
coverage_writer = ITR::Coverage::Writer.new(
|
74
|
+
transport: ITR::Coverage::Transport.new(api: test_visibility_api)
|
75
|
+
)
|
76
|
+
|
77
|
+
# configure tracing writer to send traces to CI visibility backend
|
78
|
+
writer_options[:transport] = TestVisibility::Transport.new(
|
56
79
|
api: test_visibility_api,
|
57
80
|
serializers_factory: serializers_factory(settings),
|
58
81
|
dd_env: settings.env
|
@@ -71,21 +94,40 @@ module Datadog
|
|
71
94
|
|
72
95
|
settings.tracing.test_mode.writer_options = writer_options
|
73
96
|
|
74
|
-
|
75
|
-
enabled: settings.ci.enabled && settings.ci.itr_enabled
|
76
|
-
)
|
97
|
+
custom_configuration_tags = Utils::TestRun.custom_configuration(settings.tags)
|
77
98
|
|
78
99
|
remote_settings_api = Transport::RemoteSettingsApi.new(
|
79
100
|
api: test_visibility_api,
|
80
|
-
dd_env: settings.env
|
101
|
+
dd_env: settings.env,
|
102
|
+
config_tags: custom_configuration_tags
|
81
103
|
)
|
82
104
|
|
105
|
+
itr = ITR::Runner.new(
|
106
|
+
api: test_visibility_api,
|
107
|
+
dd_env: settings.env,
|
108
|
+
config_tags: custom_configuration_tags,
|
109
|
+
coverage_writer: coverage_writer,
|
110
|
+
enabled: settings.ci.enabled && settings.ci.itr_enabled
|
111
|
+
)
|
112
|
+
|
113
|
+
git_tree_uploader = Git::TreeUploader.new(api: test_visibility_api)
|
114
|
+
git_tree_upload_worker = if settings.ci.git_metadata_upload_enabled
|
115
|
+
Worker.new do |repository_url|
|
116
|
+
git_tree_uploader.call(repository_url)
|
117
|
+
end
|
118
|
+
else
|
119
|
+
DummyWorker.new
|
120
|
+
end
|
121
|
+
|
83
122
|
# CI visibility recorder global instance
|
84
123
|
@ci_recorder = TestVisibility::Recorder.new(
|
85
124
|
test_suite_level_visibility_enabled: !settings.ci.force_test_level_visibility,
|
86
125
|
itr: itr,
|
87
|
-
remote_settings_api: remote_settings_api
|
126
|
+
remote_settings_api: remote_settings_api,
|
127
|
+
git_tree_upload_worker: git_tree_upload_worker
|
88
128
|
)
|
129
|
+
|
130
|
+
@itr = itr
|
89
131
|
end
|
90
132
|
|
91
133
|
def build_test_visibility_api(settings)
|
@@ -122,9 +164,9 @@ module Datadog
|
|
122
164
|
|
123
165
|
def serializers_factory(settings)
|
124
166
|
if settings.ci.force_test_level_visibility
|
125
|
-
|
167
|
+
TestVisibility::Serializers::Factories::TestLevel
|
126
168
|
else
|
127
|
-
|
169
|
+
TestVisibility::Serializers::Factories::TestSuiteLevel
|
128
170
|
end
|
129
171
|
end
|
130
172
|
|
@@ -61,6 +61,12 @@ module Datadog
|
|
61
61
|
o.default false
|
62
62
|
end
|
63
63
|
|
64
|
+
option :git_metadata_upload_enabled do |o|
|
65
|
+
o.type :bool
|
66
|
+
o.env CI::Ext::Settings::ENV_GIT_METADATA_UPLOAD_ENABLED
|
67
|
+
o.default true
|
68
|
+
end
|
69
|
+
|
64
70
|
define_method(:instrument) do |integration_name, options = {}, &block|
|
65
71
|
return unless enabled
|
66
72
|
|