[SDK] Fixes duration overflow#3529
Merged
marcalff merged 5 commits intoopen-telemetry:mainfrom Jul 10, 2025
Merged
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This PR removes unnecessary nanosecond conversions to prevent overflow and simplifies timeout handling by working directly with std::chrono::microseconds.
- Eliminates casting to
nanosecondsand unused overflow logic. - Updates
ForceFlushandShutdownto use microseconds consistently. - Adjusts expiration-time calculations accordingly.
Comments suppressed due to low confidence (2)
sdk/src/logs/multi_log_record_processor.cc:77
- Consider adding unit tests for edge cases where
timeoutapproachessystem_clock::time_point::maxto verify the new overflow logic under UBSAN.
bool MultiLogRecordProcessor::ForceFlush(std::chrono::microseconds timeout) noexcept
sdk/src/logs/multi_log_record_processor.cc:4
- [nitpick] The header is added but no algorithms from it are used in this file. Consider removing it to keep includes minimal.
#include <algorithm>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3529 +/- ##
==========================================
+ Coverage 89.96% 89.98% +0.02%
==========================================
Files 219 219
Lines 7051 7044 -7
==========================================
- Hits 6343 6338 -5
+ Misses 708 706 -2
🚀 New features to boost your workflow:
|
lalitb
reviewed
Jul 10, 2025
lalitb
reviewed
Jul 10, 2025
lalitb
reviewed
Jul 10, 2025
lalitb
approved these changes
Jul 10, 2025
marcalff
approved these changes
Jul 10, 2025
malkia
added a commit
to malkia/opentelemetry-cpp
that referenced
this pull request
Jul 10, 2025
[SDK] Fixes duration overflow (open-telemetry#3529)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3528
Changes
For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes