-
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:1674, Add Monotonic Property to Sum Aggregation, and unit tests for Up Down Counter #1675
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1675 +/- ##
==========================================
- Coverage 86.38% 86.26% -0.11%
==========================================
Files 169 169
Lines 5146 5160 +14
==========================================
+ Hits 4445 4451 +6
- Misses 701 709 +8
|
OTEL_INTERNAL_LOG_WARN(" Negative value ignored for Monotonic increasing measurement. Value" | ||
<< value); | ||
return; | ||
} | ||
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_); | ||
point_data_.value_ = nostd::get<long>(point_data_.value_) + value; |
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.
Does overflow need to be handled here for the sum operation?
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.
With #1686 we use int64_t to store the sum. The numeric range limit of signed 64-bit is enormous, while it can still eventually overflow if the system generating measurement keeps running for long, without resetting. Unless there are real-world scenarios for the overflow, I think we can let go for now the overflow scenario (and so avoid extra validation for every measurement added). Even in the case of such real-world examples, the exporter can be configured with Delta temporality (if the backend system supports it), and so it would bypass adding the values. Otherwise, we can rely on the backend system to detect any such overflow and handle it accordingly.
Have fixed the CI errors. This should be good to review now. |
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.
LGTM
just had a few minor comments
Thanks for the PR :)
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.
LGTM
if (point_data_.is_monotonic_ && value < 0) | ||
{ | ||
OTEL_INTERNAL_LOG_WARN(" Negative value ignored for Monotonic increasing measurement. Value" | ||
<< value); |
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.
Ok for now.
In the long term, to be of any use, the warning message will need to add some context, like the name of the meter / metric involved that causes the warning.
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. added slightly more context here.
|
||
using namespace opentelemetry::sdk::metrics; | ||
using namespace opentelemetry::common; | ||
using M = std::map<std::string, std::string>; |
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.
Is using M
as namespace alias from some convention?
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.
No, I don't think there is any convention. What do you recommend ?
instr_desc, AggregationType::kSum, default_attributes_processor.get(), | ||
ExemplarReservoir::GetNoExemplarReservoir(), nullptr); | ||
|
||
storage.RecordLong(10l, KeyValueIterableView<std::map<std::string, std::string>>(attributes_get), |
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.
define the number 10l
as a variable as it is shared between this and the following line?
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, done
…ad-local-stack * commit '9acde87b08b225ce511fa8a20c6cba14f2921518': (36 commits) Prepare v1.7.0 release with Metrics API/SDK GA. (open-telemetry#1721) Fix: 1712 - Validate Instrument meta data (name, unit, description) (open-telemetry#1713) Document libthrift 0.12.0 doesn't work with Jaeger exporter (open-telemetry#1714) Fix:1674, Add Monotonic Property to Sum Aggregation, and unit tests for Up Down Counter (open-telemetry#1675) [Metrics SDK] Move Metrics Exemplar processing behind feature flag (open-telemetry#1710) [Metrics API/SDK] Change Meter API/SDK to return nostd::unique_ptr for Sync Instruments (open-telemetry#1707) [Metrics] Switch to explicit 64 bit integers (open-telemetry#1686) Add metrics e2e test to asan & tsan CI (open-telemetry#1670) Add otlp-grpc example bazel (open-telemetry#1708) [Metrics SDK] Add support for Pull Metric Reader (open-telemetry#1701) Fix debug log of OTLP HTTP exporter and ES log exporter (open-telemetry#1703) [SEMANTIC CONVENTIONS] Upgrade to version 1.14.0 (open-telemetry#1697) Fix a potential precision loss on integer in ReservoirCellIndexFor (open-telemetry#1696) fix Histogram crash (open-telemetry#1685) Fix:1676 Segfault when short export period is used for metrics (open-telemetry#1682) Add timeout support to MeterContext::ForceFlush (open-telemetry#1673) Add CMake OTELCPP_MAINTAINER_MODE (open-telemetry#1650) [DOCS] - Minor updates to OStream Metrics exporter documentation (open-telemetry#1679) Fix:open-telemetry#1575 API Documentation for Metrics SDK and API (open-telemetry#1678) Fixes open-telemetry#249 (open-telemetry#1677) ...
…or Up Down Counter (open-telemetry#1675)
Fixes #1674
Changes
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes