-
Notifications
You must be signed in to change notification settings - Fork 475
Fix lifetime for sdk::ReadWriteLogRecord #3147
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
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 90.04% 90.02% -0.01%
==========================================
Files 212 213 +1
Lines 6932 7120 +188
==========================================
+ Hits 6241 6409 +168
- Misses 691 711 +20
🚀 New features to boost your workflow:
|
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
?
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.
Any idea about keep the mixed types or change the API of ReadableLogRecord::GetAttributes
?
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.
…ecord # Conflicts: # exporters/ostream/test/ostream_log_test.cc
…ecord # Conflicts: # CHANGELOG.md
… fix_lifetime_in_log_record # Conflicts: # CHANGELOG.md
Another note to myself that I really really need to review this. @owent Could you refresh the patch and merge with a recent main ? Also, make sure there are no changes under third_party. Thanks. |
Thanks, conflicts are resolved. |
Is the update to the prometheus-cpp submodule expected? |
I don't understand all the reasoning that lead to this current patch, it looks way too complicated to me. Either I totally missed something, or it can be done in a simpler way. Please see a different attempt to resolve the same issues, and comment: |
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