-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIVIS-8333] improvements for manual tracing API #108
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… none is provided
…erved for CI visibility
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #108 +/- ##
==========================================
- Coverage 99.10% 99.10% -0.01%
==========================================
Files 149 147 -2
Lines 6383 6269 -114
Branches 277 286 +9
==========================================
- Hits 6326 6213 -113
+ Misses 57 56 -1 ☔ View full report in Codecov by Sentry. |
…irectly to avoid exposing via public API
…fered with class hierarchy (see #set_parameters method - now it can be moved down to Datadog::CI::Test model)
juan-fernandez
approved these changes
Jan 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR is aimed to simplify and improve manual test tracing API. These changes are the last planned breaking changes before 1.0 release of this library when we'll declare this API stable.
Changes include:
Datadog::CI.trace
now accepttype
as optional keyword argument ("span" by default) - this method is used to trace any custom spans inside the test["test", "test_suite_end", "test_module_end", "test_session_end"]
- these events are reserved for CI visibility and must be created via respective manual API methods (CI.start_test
,CI.start_test_suite
,CI.start_test_module
,CI.start_test_session
)Datadog::CI.active_span
does not havetype
parameter anymore and returns any custom span (not having CI-specific type) that is active now inDatadog::Tracing::Tracer
Datadog::CI::TestVisibility::Recorder#deactivate_test
no longer accepts arguments and deactivates any test that is currently running (as we allow a single test running at any time per thread/fiber)CI.deactivate_*
methods as they had a very weird place in the API: being public but declared internal and not to be used by API consumers. Instead,Datadog::CI::Span
now has direct access to theDatadog::CI::TestVisibility::Recorder
singleton instance viaDatadog.components
NullSpan
class and "Null object" pattern for CI visibility models: while it was an interesting experiment, it made class hierarchy less sound (i.e. NullSpan is a child of Span but not Test, which made me put set_parameters method in Span when it belongs to Test). I had to either provide Null* classes for every CI model or revert to having nil values and nil checks. I chose the latter approach for simplicity and less confusion.Overall, this PR led to more deleted lines of code than added which I consider a very good result when doing refactoring.
Motivation
First stable version is to be released soon and last minute improvements due for manual API.