Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename bswap_64 to otel_bswap_64 to avoid clash with macro (#875) #876

Merged
merged 1 commit into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ namespace jaeger

# if defined(__clang__) || \
(defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ >= 5))
inline uint64_t bswap_64(uint64_t host_int)
inline uint64_t otel_bswap_64(uint64_t host_int)
{
return __builtin_bswap64(host_int);
}

# elif defined(_MSC_VER)
inline uint64_t bswap_64(uint64_t host_int)
inline uint64_t otel_bswap_64(uint64_t host_int)
{
return _byteswap_uint64(host_int);
}
Expand Down
8 changes: 4 additions & 4 deletions exporters/jaeger/src/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ void Recordable::SetIdentity(const trace::SpanContext &span_context,
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md#ids
#if JAEGER_IS_LITTLE_ENDIAN == 1
span_->__set_traceIdHigh(
bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()))));
otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()))));
span_->__set_traceIdLow(
bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()) + 1)));
otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()) + 1)));
span_->__set_spanId(
bswap_64(*(reinterpret_cast<const int64_t *>(span_context.span_id().Id().data()))));
otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.span_id().Id().data()))));
span_->__set_parentSpanId(
bswap_64(*(reinterpret_cast<const int64_t *>(parent_span_id.Id().data()))));
otel_bswap_64(*(reinterpret_cast<const int64_t *>(parent_span_id.Id().data()))));
#else
span_->__set_traceIdLow(
*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data())));
Expand Down
10 changes: 5 additions & 5 deletions exporters/jaeger/test/jaeger_recordable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ TEST(JaegerSpanRecordable, SetIdentity)
std::unique_ptr<thrift::Span> span{rec.Span()};

#if JAEGER_IS_LITTLE_ENDIAN == 1
EXPECT_EQ(span->traceIdLow, opentelemetry::exporter::jaeger::bswap_64(trace_id_val[1]));
EXPECT_EQ(span->traceIdHigh, opentelemetry::exporter::jaeger::bswap_64(trace_id_val[0]));
EXPECT_EQ(span->spanId, opentelemetry::exporter::jaeger::bswap_64(span_id_val));
EXPECT_EQ(span->parentSpanId, opentelemetry::exporter::jaeger::bswap_64(parent_span_id_val));
EXPECT_EQ(span->traceIdLow, opentelemetry::exporter::jaeger::otel_bswap_64(trace_id_val[1]));
EXPECT_EQ(span->traceIdHigh, opentelemetry::exporter::jaeger::otel_bswap_64(trace_id_val[0]));
EXPECT_EQ(span->spanId, opentelemetry::exporter::jaeger::otel_bswap_64(span_id_val));
EXPECT_EQ(span->parentSpanId, opentelemetry::exporter::jaeger::otel_bswap_64(parent_span_id_val));
#else
EXPECT_EQ(span->traceIdLow, trace_id_val[0]);
EXPECT_EQ(span->traceIdHigh, trace_id_val[1]);
Expand Down Expand Up @@ -143,4 +143,4 @@ TEST(JaegerSpanRecordable, SetInstrumentationLibrary)
EXPECT_EQ(tags[1].key, "otel.library.version");
EXPECT_EQ(tags[1].vType, thrift::TagType::STRING);
EXPECT_EQ(tags[1].vStr, library_version);
}
}