Skip to content

Commit

Permalink
address review comments; fix clang otel disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolduc committed Mar 17, 2023
1 parent 7ee82fd commit 985901b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions google/cloud/internal/opentelemetry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,16 @@ std::function<void(std::chrono::milliseconds)> MakeTracedSleeper(
return sleeper;
}

// NOLINTNEXTLINE(misc-unused-value-param)
void AddSpanAttribute(std::string const& key, std::string const& value) {
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
void AddSpanAttribute(std::string const& key, std::string const& value) {
if (TracingEnabled(CurrentOptions())) {
auto span = opentelemetry::trace::Tracer::GetCurrentSpan();
span->SetAttribute(std::move(key), std::move(value));
span->SetAttribute(key, value);
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
}
#else
void AddSpanAttribute(std::string const&, std::string const&) {}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace internal
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down

0 comments on commit 985901b

Please sign in to comment.