diff --git a/lib/datadog/ci.rb b/lib/datadog/ci.rb index dca2306b..0b54dc04 100644 --- a/lib/datadog/ci.rb +++ b/lib/datadog/ci.rb @@ -39,11 +39,11 @@ def trace(span_type, span_name, span_options = {}) span_options[:span_type] = span_type if block_given? - Datadog::Tracing.trace(span_name, **span_options) do |tracer_span| + ::Datadog::Tracing.trace(span_name, **span_options) do |tracer_span| yield Span.new(tracer_span) end else - tracer_span = Datadog::Tracing.trace(span_name, **span_options) + tracer_span = ::Datadog::Tracing.trace(span_name, **span_options) Span.new(tracer_span) end end diff --git a/lib/datadog/ci/recorder.rb b/lib/datadog/ci/recorder.rb index 4f5867ad..d99c5b28 100644 --- a/lib/datadog/ci/recorder.rb +++ b/lib/datadog/ci/recorder.rb @@ -57,22 +57,6 @@ def self.set_tags!(trace, span, tags = {}) span end - def self.passed!(span) - span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::PASS) - end - - def self.failed!(span, exception = nil) - span.status = 1 - span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::FAIL) - span.set_error(exception) unless exception.nil? - end - - def self.skipped!(span, exception = nil, reason = nil) - span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::SKIP) - span.set_error(exception) unless exception.nil? - span.set_tag(CI::Ext::Test::TAG_SKIP_REASON, reason) unless reason.nil? - end - private_class_method def self.set_environment_runtime_tags!(span) span.set_tag(Ext::Test::TAG_OS_ARCHITECTURE, ::RbConfig::CONFIG["host_cpu"]) span.set_tag(Ext::Test::TAG_OS_PLATFORM, ::RbConfig::CONFIG["host_os"]) diff --git a/lib/datadog/ci/span.rb b/lib/datadog/ci/span.rb index b7874edb..92def7f8 100644 --- a/lib/datadog/ci/span.rb +++ b/lib/datadog/ci/span.rb @@ -11,15 +11,19 @@ def initialize(tracer_span) end def passed! - CI::Recorder.passed!(@tracer_span) + tracer_span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::PASS) end def failed!(exception = nil) - CI::Recorder.failed!(@tracer_span, exception) + tracer_span.status = 1 + tracer_span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::FAIL) + tracer_span.set_error(exception) unless exception.nil? end def skipped!(exception = nil, reason = nil) - CI::Recorder.skipped!(@tracer_span, exception, reason) + tracer_span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::SKIP) + tracer_span.set_error(exception) unless exception.nil? + tracer_span.set_tag(CI::Ext::Test::TAG_SKIP_REASON, reason) unless reason.nil? end def finish