-
Notifications
You must be signed in to change notification settings - Fork 440
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
Fix lifetime for sdk::ReadWriteLogRecord #3147
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3147 +/- ##
==========================================
+ Coverage 88.16% 88.18% +0.02%
==========================================
Files 198 199 +1
Lines 6224 6412 +188
==========================================
+ Hits 5487 5654 +167
- Misses 737 758 +21
|
struct MixedAttributeMapStorage | ||
{ | ||
std::unordered_map<std::string, opentelemetry::common::AttributeValue> attributes; | ||
AttributeMap owened_attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a typo:
AttributeMap owened_attributes; | |
AttributeMap owned_attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it's fixed now.
I don't know if this is critical, but this change breaks the ABI:
To reproduce: cmake -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="-Og -g3" --fresh
cmake --build build -j$(nproc) --clean-first
cmake --install build --prefix ORIG
wget https://patch-diff.githubusercontent.com/raw/open-telemetry/opentelemetry-cpp/pull/3147.diff
patch -p1 < 3147.diff
cmake --build build -j$(nproc)
cmake --install build --prefix NEW
mkdir dumps
for i in ORIG/lib/*.so; do abi-dumper "$i" -o "dumps/orig-$(basename "$i").dump" -lver orig; done
for i in NEW/lib/*.so; do abi-dumper "$i" -o "dumps/new-$(basename "$i").dump" -lver new; done
for i in NEW/lib/*.so; do abi-compliance-checker -l "$(basename "$i")" -old "dumps/orig-$(basename "$i").dump" -new "dumps/new-$(basename "$i").dump; done It will show smth like
|
If I didn't miss anything, I think we only need to keep ABI compatibility for api. These changes keep API compatibility for sdk and exporters. |
I noticed that the library does not have a SOVERSION and thought that the changes could break the existing consumers (I know that Alpine Linux ships OpenTelemetry C++ libraries). That's why I asked :-) |
If we build otel-cpp with cmake, we can use
Thanks. I noticed #3110 and agree with the SOVERSION idea. Let's continue discussing it there. |
@owent Thanks for the PR. With the use of the How about having two separate recordables:
|
Good point. |
/** | ||
* Set an owned copy (OwnedAttributeValue) and attribute view of a non-owning AttributeValue. | ||
*/ | ||
class MixedAttributeViewSetter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owent - Do we still need this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still used by MixedAttributeMap
, which is used by LogRecordData
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are some differents between LogRecordData
and SpanData
.
SpanData::GetAttributes
returns std::unordered_map<std::string, opentelemetry::sdk::common::OwnedAttributeValue>
but LogRecordData::GetAttributes
returns std::unordered_map<std::string, opentelemetry::common::AttributeValue>
.
We need storage to store span<T>
in opentelemetry::common::AttributeValue
, or do you think we can break the API of
ReadableLogRecord::GetAttributes
?
Fixes #3135
Fixes #2651
Changes
MixedAttributeMap
to store bothstd::unordered_map<std::string, opentelemetry::common::AttributeValue>
andAttributeMap
OwnedAttributeValue
,std::vector<nostd::string_view>
andbool
array forReadWriteLogRecord
.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes