Skip to content

Commit

Permalink
Fix SumAggregation (open-telemetry#3390)
Browse files Browse the repository at this point in the history
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
  • Loading branch information
ocelotl and aabmass authored Oct 13, 2023
1 parent 0660924 commit d054dff
Show file tree
Hide file tree
Showing 5 changed files with 698 additions and 89 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fix `SumAggregation`
 ([#3390](https://github.com/open-telemetry/opentelemetry-python/pull/3390))
- Fix handling of empty metric collection cycles
([#3335](https://github.com/open-telemetry/opentelemetry-python/pull/3335))
- Fix error when no LoggerProvider configured for LoggingHandler
Expand All @@ -24,7 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Prometheus exporter support for auto instrumentation
([#3413](https://github.com/open-telemetry/opentelemetry-python/pull/3413))


## Version 1.20.0/0.41b0 (2023-09-04)

- Modify Prometheus exporter to translate non-monotonic Sums into Gauges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def conflicts(self, other: "_ViewInstrumentMatch") -> bool:
result
and self._aggregation._instrument_is_monotonic
== other._aggregation._instrument_is_monotonic
and self._aggregation._instrument_temporality
== other._aggregation._instrument_temporality
and self._aggregation._instrument_aggregation_temporality
== other._aggregation._instrument_aggregation_temporality
)

return result
Expand Down Expand Up @@ -124,15 +124,15 @@ def consume_measurement(self, measurement: Measurement) -> None:

def collect(
self,
aggregation_temporality: AggregationTemporality,
collection_aggregation_temporality: AggregationTemporality,
collection_start_nanos: int,
) -> Optional[Sequence[DataPointT]]:

data_points: List[DataPointT] = []
with self._lock:
for aggregation in self._attributes_aggregation.values():
data_point = aggregation.collect(
aggregation_temporality, collection_start_nanos
collection_aggregation_temporality, collection_start_nanos
)
if data_point is not None:
data_points.append(data_point)
Expand Down
Loading

0 comments on commit d054dff

Please sign in to comment.