Repository navigation
Conversation
opentelemetry-cpp's nostd::variant and nostd::string_view are aliases
for std::variant and std::string_view only when opentelemetry-cpp is
built with WITH_STL. With the default (non-STL) build they are
opentelemetry-cpp's own types, and calling std::visit, std::get or
std::holds_alternative on them, or passing a std::string_view where a
nostd::string_view is expected, fails to compile.
Use opentelemetry::nostd::{visit,get,holds_alternative} and an explicit
nostd::string_view conversion, as other parts of the code (e.g.
bigtable and storage monitoring) already do. This works with both STL
and non-STL builds of opentelemetry-cpp.
There was a problem hiding this comment.
Code Review
This pull request replaces standard library components such as std::visit, std::holds_alternative, std::get, and implicit string conversions with their OpenTelemetry non-standard equivalents (opentelemetry::nostd::visit, opentelemetry::nostd::holds_alternative, opentelemetry::nostd::get, and opentelemetry::nostd::string_view) across several tracing and telemetry internal source files. I have no feedback to provide as the changes are consistent and correct.
|
/gcbrun |
|
/gharun |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16624 +/- ##
=======================================
Coverage 92.47% 92.47%
=======================================
Files 2269 2269
Lines 222037 222038 +1
=======================================
+ Hits 205323 205336 +13
+ Misses 16714 16702 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
opentelemetry-cpp's nostd::variant and nostd::string_view are aliases for std::variant and std::string_view only when opentelemetry-cpp is built with WITH_STL. With the default (non-STL) build they are opentelemetry-cpp's own types, and calling std::visit, std::get or std::holds_alternative on them, or passing a std::string_view where a nostd::string_view is expected, fails to compile.
Use opentelemetry::nostd::{visit,get,holds_alternative} and an explicit nostd::string_view conversion, as other parts of the code (e.g. bigtable and storage monitoring) already do. This works with both STL and non-STL builds of opentelemetry-cpp.