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

Copy AggregationTemporality and IsMonotonic to new metric batches #4389

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

dashpole
Copy link
Contributor

Description:
Fix a regression in which metric batches do not have aggregation temporality and IsMonotonic set for cumulative metrics. The issue was introduced in #3573, where we changed to having to copy each field from the old metric to the new one. These fields were missed, and thus get their default value when new batches of metrics were created.

I looked at the implementation of CopyTo that is used for copying metrics elsewhere to make sure I fix all issues of this type. For Sum, we are missing AggregationTemporality and IsMonotonic. We were also missing AggregationTemporality for histograms, so I added that as well. Both summary and gauges only copy data points, so the status quo is correct.

Link to tracking Issue:
Fixes #4388

Testing:

Unit testing. The test changes I made fail without the corresponding changes to metric splitting. I haven't had a chance to e2e test it yet to show that it fixes the issue I was seeing, but it seems fairly obvious that this is the correct fix for my problems.

cc @Aneurysm9

@dashpole dashpole requested review from a team and tigrannajaryan November 10, 2021 07:27
@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #4389 (07a519c) into main (3ef6d73) will decrease coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4389      +/-   ##
==========================================
- Coverage   88.67%   88.67%   -0.01%     
==========================================
  Files         176      176              
  Lines       10377    10380       +3     
==========================================
+ Hits         9202     9204       +2     
- Misses        947      948       +1     
  Partials      228      228              
Impacted Files Coverage Δ
processor/batchprocessor/splitmetrics.go 71.09% <66.66%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ef6d73...07a519c. Read the comment docs.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

We should add a changelog note for this

return splitNumberDataPoints(ms.Sum().DataPoints(), dest.Sum().DataPoints(), size)
case pdata.MetricDataTypeHistogram:
dest.Histogram().SetAggregationTemporality(ms.Histogram().AggregationTemporality())
Copy link
Member

Choose a reason for hiding this comment

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

It would help to add a testcase for this, to avoid further regressions

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Member

Choose a reason for hiding this comment

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

@dashpole please do a followup PR.

return splitNumberDataPoints(ms.Sum().DataPoints(), dest.Sum().DataPoints(), size)
case pdata.MetricDataTypeHistogram:
dest.Histogram().SetAggregationTemporality(ms.Histogram().AggregationTemporality())
Copy link
Member

Choose a reason for hiding this comment

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

+1

@bogdandrutu bogdandrutu merged commit 719d371 into open-telemetry:main Nov 10, 2021
@dashpole dashpole deleted the fix_batching branch November 10, 2021 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Batch processor not setting metric descriptor correctly when splitting batches of metrics.
3 participants