@@ -508,6 +508,11 @@ TEST(Tracer, StartSpanWithDisabledConfig)
508
508
std::make_shared<opentelemetry::trace::NoopTracer>();
509
509
auto noop_span = noop_tracer->StartSpan (" noop" );
510
510
EXPECT_TRUE (span.get () == noop_span.get ());
511
+
512
+ #if OPENTELEMETRY_ABI_VERSION_NO >= 2
513
+ EXPECT_FALSE (noop_tracer->Enabled ());
514
+ EXPECT_FALSE (tracer->Enabled ());
515
+ #endif
511
516
}
512
517
513
518
TEST (Tracer, StartSpanWithEnabledConfig)
@@ -524,6 +529,11 @@ TEST(Tracer, StartSpanWithEnabledConfig)
524
529
std::make_shared<opentelemetry::trace::NoopTracer>();
525
530
auto noop_span = noop_tracer->StartSpan (" noop" );
526
531
EXPECT_FALSE (span.get () == noop_span.get ());
532
+
533
+ #if OPENTELEMETRY_ABI_VERSION_NO >= 2
534
+ EXPECT_FALSE (noop_tracer->Enabled ());
535
+ EXPECT_TRUE (tracer->Enabled ());
536
+ #endif
527
537
}
528
538
529
539
TEST (Tracer, StartSpanWithCustomConfig)
@@ -567,6 +577,14 @@ TEST(Tracer, StartSpanWithCustomConfig)
567
577
new RandomIdGenerator (), custom_configurator, std::move (bar_scope));
568
578
auto span_bar_scope = tracer_bar_scope->StartSpan (" span 1" );
569
579
EXPECT_FALSE (span_bar_scope == noop_span);
580
+
581
+ #if OPENTELEMETRY_ABI_VERSION_NO >= 2
582
+ EXPECT_FALSE (noop_tracer->Enabled ());
583
+ EXPECT_FALSE (tracer_default_scope->Enabled ());
584
+ EXPECT_FALSE (tracer_foo_scope->Enabled ());
585
+ EXPECT_TRUE (tracer_foo_scope_with_version->Enabled ());
586
+ EXPECT_TRUE (tracer_bar_scope->Enabled ());
587
+ #endif
570
588
}
571
589
572
590
TEST (Tracer, StartSpanWithCustomConfigDifferingConditionOrder)
@@ -608,6 +626,11 @@ TEST(Tracer, StartSpanWithCustomConfigDifferingConditionOrder)
608
626
// evaluating other condition
609
627
const auto span_foo_scope_with_version_2 = tracer_foo_scope_with_version_2->StartSpan (" span 1" );
610
628
EXPECT_TRUE (span_foo_scope_with_version_2 == noop_span);
629
+
630
+ #if OPENTELEMETRY_ABI_VERSION_NO >= 2
631
+ EXPECT_TRUE (tracer_foo_scope_with_version_1->Enabled ());
632
+ EXPECT_FALSE (tracer_foo_scope_with_version_2->Enabled ());
633
+ #endif
611
634
}
612
635
613
636
TEST (Tracer, SpanSetLinks)
0 commit comments