Skip to content

Commit

Permalink
Disable by default
Browse files Browse the repository at this point in the history
  • Loading branch information
chusitoo committed Jan 9, 2023
1 parent ddd71ab commit 4d91681
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ option(BUILD_W3CTRACECONTEXT_TEST "Whether to build w3c trace context" OFF)

option(OTELCPP_MAINTAINER_MODE "Build in maintainer mode (-Wall -Werror)" OFF)

option(WITH_OPENTRACING "Whether to include the Opentracing shim" ON)
option(WITH_OPENTRACING "Whether to include the Opentracing shim" OFF)

set(OTELCPP_PROTO_PATH
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ class LinksIterable final : public opentelemetry::trace::SpanContextKeyValueIter
public:
using RefsList = std::vector<std::pair<opentracing::SpanReferenceType, const opentracing::SpanContext*>>;
explicit LinksIterable(const RefsList& refs) noexcept : refs_(refs) {}
bool ForEachKeyValue(nostd::function_ref<bool(opentelemetry::trace::SpanContext,

bool ForEachKeyValue(nostd::function_ref<bool(opentelemetry::trace::SpanContext,
const opentelemetry::common::KeyValueIterable&)>
callback) const noexcept override
{
using opentracing::SpanReferenceType;
using namespace opentelemetry::trace::SemanticConventions;
using LinksList = std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>;

for (const auto& entry : refs_)
{
auto context_shim = dynamic_cast<const SpanContextShim*>(entry.second);
Expand All @@ -138,7 +138,7 @@ class LinksIterable final : public opentelemetry::trace::SpanContextKeyValueIter

if (context_shim && !span_kind.empty())
{
if (!callback(context_shim->context(),
if (!callback(context_shim->context(),
opentelemetry::common::KeyValueIterableView<LinksList>(
{{ kOpentracingRefType, span_kind }})))
return false;
Expand Down
2 changes: 1 addition & 1 deletion opentracing-shim/test/shim_mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct MockSpan final : public trace_api::Span

void AddEvent(nostd::string_view name) noexcept override {}

void SetStatus(trace_api::StatusCode code, nostd::string_view description) noexcept override
void SetStatus(trace_api::StatusCode code, nostd::string_view description) noexcept override
{
status_ = {code, description.data()};
}
Expand Down
12 changes: 6 additions & 6 deletions opentracing-shim/test/shim_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TEST(ShimUtilsTest, MakeOptionsShim_EmptyRefs)
auto span_context_shim = nostd::shared_ptr<shim::SpanContextShim>(new shim::SpanContextShim(
trace_api::SpanContext::GetInvalid(), baggage::Baggage::GetDefault()));
auto span_context = static_cast<opentracing::SpanContext*>(span_context_shim.get());

opentracing::StartSpanOptions options;
options.start_system_timestamp = opentracing::SystemTime::time_point::clock::now();
options.start_steady_timestamp = opentracing::SteadyTime::time_point::clock::now();
Expand All @@ -119,7 +119,7 @@ TEST(ShimUtilsTest, MakeOptionsShim_InvalidSpanContext)
auto span_context_shim = nostd::shared_ptr<shim::SpanContextShim>(new shim::SpanContextShim(
trace_api::SpanContext::GetInvalid(), baggage::Baggage::GetDefault()));
auto span_context = static_cast<opentracing::SpanContext*>(span_context_shim.get());

opentracing::StartSpanOptions options;
options.start_system_timestamp = opentracing::SystemTime::time_point::clock::now();
options.start_steady_timestamp = opentracing::SteadyTime::time_point::clock::now();
Expand All @@ -136,7 +136,7 @@ TEST(ShimUtilsTest, MakeOptionsShim_FirstChildOf)
auto span_context_shim = nostd::shared_ptr<shim::SpanContextShim>(new shim::SpanContextShim(
trace_api::SpanContext::GetInvalid(), baggage::Baggage::GetDefault()));
auto span_context = static_cast<opentracing::SpanContext*>(span_context_shim.get());

opentracing::StartSpanOptions options;
options.start_system_timestamp = opentracing::SystemTime::time_point::clock::now();
options.start_steady_timestamp = opentracing::SteadyTime::time_point::clock::now();
Expand All @@ -157,7 +157,7 @@ TEST(ShimUtilsTest, MakeOptionsShim_FirstInList)
auto span_context_shim = nostd::shared_ptr<shim::SpanContextShim>(new shim::SpanContextShim(
trace_api::SpanContext::GetInvalid(), baggage::Baggage::GetDefault()));
auto span_context = static_cast<opentracing::SpanContext*>(span_context_shim.get());

opentracing::StartSpanOptions options;
options.start_system_timestamp = opentracing::SystemTime::time_point::clock::now();
options.start_steady_timestamp = opentracing::SteadyTime::time_point::clock::now();
Expand Down Expand Up @@ -237,11 +237,11 @@ TEST(ShimUtilsTest, MakeBaggage_EmptyRefs)
TEST(ShimUtilsTest, MakeBaggage_NonEmptyRefs)
{
auto span_context_shim1 = nostd::shared_ptr<shim::SpanContextShim>(new shim::SpanContextShim(
trace_api::SpanContext::GetInvalid(),
trace_api::SpanContext::GetInvalid(),
baggage::Baggage::GetDefault()->Set("test", "foo")->Set("test1", "hello")));
auto span_context1 = static_cast<opentracing::SpanContext*>(span_context_shim1.get());
auto span_context_shim2 = nostd::shared_ptr<shim::SpanContextShim>(new shim::SpanContextShim(
trace_api::SpanContext::GetInvalid(),
trace_api::SpanContext::GetInvalid(),
baggage::Baggage::GetDefault()->Set("test", "bar")->Set("test2", "world")));
auto span_context2 = static_cast<opentracing::SpanContext*>(span_context_shim2.get());

Expand Down
2 changes: 1 addition & 1 deletion opentracing-shim/test/span_context_shim_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ TEST_F(SpanContextShimTest, ForeachBaggageItem)
ASSERT_EQ(concatenated.size(), 3);
ASSERT_EQ(concatenated[0], "foo:bar");
ASSERT_EQ(concatenated[1], "bar:baz");
ASSERT_EQ(concatenated[2], "baz:foo");
ASSERT_EQ(concatenated[2], "baz:foo");
}

TEST_F(SpanContextShimTest, Clone)
Expand Down
4 changes: 2 additions & 2 deletions opentracing-shim/test/span_shim_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST_F(SpanShimTest, SetBaggageItem_MultiThreaded)
std::vector<std::string> values;
int thread_count = 100;

for (int index = 0; index < thread_count; ++index)
for (int index = 0; index < thread_count; ++index)
{
keys.emplace_back("key-" + std::to_string(index));
values.emplace_back("value-" + std::to_string(index));
Expand All @@ -132,7 +132,7 @@ TEST_F(SpanShimTest, SetBaggageItem_MultiThreaded)
thread.join();
}

for (int index = 0; index < thread_count; ++index)
for (int index = 0; index < thread_count; ++index)
{
ASSERT_EQ(span_shim.BaggageItem(keys[index]), values[index]);
}
Expand Down
2 changes: 1 addition & 1 deletion opentracing-shim/test/tracer_shim_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TEST_F(TracerShimTest, SpanParentChildRelationship)
ASSERT_NE(span_shim1, span_shim2);
ASSERT_EQ(span_shim1->context().ToSpanID(), span_shim2->context().ToSpanID());
ASSERT_EQ(span_shim1->context().ToTraceID(), span_shim2->context().ToTraceID());

auto span_context_shim1 = dynamic_cast<const shim::SpanContextShim*>(&span_shim1->context());
auto span_context_shim2 = dynamic_cast<const shim::SpanContextShim*>(&span_shim2->context());
ASSERT_TRUE(span_context_shim1 != nullptr);
Expand Down

0 comments on commit 4d91681

Please sign in to comment.