Closed anmarchenko closed 9 months ago
Attention: 4 lines
in your changes are missing coverage. Please review.
Comparison is base (
8dd092a
) 99.10% compared to head (c89c711
) 99.10%. Report is 7 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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.