Skip to content
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

Metric Accumulator fix for SumObservers #1381

Merged
merged 13 commits into from
Dec 11, 2020

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Dec 1, 2020

This bug makes the data from SumObserver and UpDownSumObserver instruments incorrect after the first collection. There were tests for the Processor behavior, which is relatively tricky, but not for the Accumulator. This adds a number of tests.

The means of fixing this is to let SynchronizedMove(nil) mean "reset this accumulator" without allocations, which leads to simplifying the Accumulator.

Fixes #1368

@jmacd jmacd added the bug Something isn't working label Dec 1, 2020
@codecov
Copy link

codecov bot commented Dec 1, 2020

Codecov Report

Merging #1381 (41e40e1) into master (970755b) will increase coverage by 0.4%.
The diff coverage is 94.1%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1381     +/-   ##
========================================
+ Coverage    77.6%   78.0%   +0.4%     
========================================
  Files         123     123             
  Lines        6131    6202     +71     
========================================
+ Hits         4758    4838     +80     
+ Misses       1122    1120      -2     
+ Partials      251     244      -7     
Impacted Files Coverage Δ
sdk/export/metric/metric.go 97.3% <ø> (ø)
sdk/metric/aggregator/aggregatortest/test.go 85.0% <91.2%> (+8.2%) ⬆️
sdk/metric/aggregator/array/array.go 93.7% <100.0%> (+3.7%) ⬆️
sdk/metric/aggregator/ddsketch/ddsketch.go 86.0% <100.0%> (+5.5%) ⬆️
sdk/metric/aggregator/histogram/histogram.go 95.7% <100.0%> (+4.6%) ⬆️
sdk/metric/aggregator/lastvalue/lastvalue.go 87.0% <100.0%> (+8.5%) ⬆️
sdk/metric/aggregator/minmaxsumcount/mmsc.go 96.0% <100.0%> (+4.3%) ⬆️
sdk/metric/aggregator/sum/sum.go 78.5% <100.0%> (+10.5%) ⬆️
sdk/metric/sdk.go 80.2% <100.0%> (+0.9%) ⬆️

@jmacd jmacd added the area:metrics Part of OpenTelemetry Metrics label Dec 1, 2020
Copy link
Member

@krnowak krnowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, otherwise looks good.

sdk/metric/aggregator/array/array.go Outdated Show resolved Hide resolved
@jmacd
Copy link
Contributor Author

jmacd commented Dec 10, 2020

@open-telemetry/go-approvers This is a HUGE bug, please approve. Fixes #1368.

@MrAlias MrAlias merged commit eb28005 into open-telemetry:master Dec 11, 2020
@MrAlias MrAlias mentioned this pull request Dec 11, 2020
@jmacd jmacd deleted the jmacd/sumobs_fix branch June 18, 2021 07:10
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metrics Part of OpenTelemetry Metrics bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SumObserver sums up observations
6 participants