]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/tracer: remove is_enabled check in add_span methods
authorOmri Zeneva <ozeneva@redhat.com>
Sun, 2 Oct 2022 07:30:35 +0000 (03:30 -0400)
committerYuval Lifshitz <ylifshit@redhat.com>
Thu, 7 Sep 2023 14:12:47 +0000 (14:12 +0000)
when tracing is disabled globally, new spans won't be added
to existing traces, because of that if condition.
this can happen also if a specific trace was enabled by lua script

so in case tracing is disabled, the tracer will create new spans
if it's parent span is not a noop span, regardless of tracer state

Signed-off-by: Omri Zeneva <ozeneva@redhat.com>
src/common/tracer.cc

index d822e274b43e23243f4b967d7b03c377c4962fb8..1146da319500d9336cf84b3e94f3646a3961d2a5 100644 (file)
@@ -60,8 +60,7 @@ jspan Tracer::start_trace(opentelemetry::nostd::string_view trace_name, bool tra
 }
 
 jspan Tracer::add_span(opentelemetry::nostd::string_view span_name, const jspan& parent_span) {
-  ceph_assert(cct);
-  if (is_enabled() && parent_span->IsRecording()) {
+  if (parent_span && parent_span->IsRecording()) {
     ceph_assert(tracer);
     opentelemetry::trace::StartSpanOptions span_opts;
     span_opts.parent = parent_span->GetContext();
@@ -72,8 +71,7 @@ jspan Tracer::add_span(opentelemetry::nostd::string_view span_name, const jspan&
 }
 
 jspan Tracer::add_span(opentelemetry::nostd::string_view span_name, const jspan_context& parent_ctx) {
-  ceph_assert(cct);
-  if (is_enabled() && parent_ctx.IsValid()) {
+  if (parent_ctx.IsValid()) {
     ceph_assert(tracer);
     opentelemetry::trace::StartSpanOptions span_opts;
     span_opts.parent = parent_ctx;