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

[exporter/prometheus] fix: cumulative condition based on the starttimestamp #12340

Merged
merged 6 commits into from
Jul 18, 2022

Conversation

locmai
Copy link
Contributor

@locmai locmai commented Jul 12, 2022

Description:

Fixing the erroneous change in this commit e7ab883#diff-9822bc07132ceeeb9c69a90898caccf2d9f9acefe0cef5b5bae0dc2cc9e44764R213

which it should be comparing between the startTimestamp of the next data point to the Timestamp of the last data point.

Link to tracking Issue: N/A

Testing:

The similar way in #9919

@locmai locmai requested a review from a team July 12, 2022 19:19
@locmai locmai requested a review from Aneurysm9 as a code owner July 12, 2022 19:19
@locmai locmai force-pushed the fix/cumulative-condition branch from 8bb9309 to 0a47c01 Compare July 12, 2022 19:19
locmai added 3 commits July 13, 2022 02:24
Signed-off-by: Loc Mai <[email protected]>
This reverts commit 6717c52.

Signed-off-by: Loc Mai <[email protected]>
Signed-off-by: Loc Mai <[email protected]>
Copy link
Contributor

@jmacd jmacd left a comment

Choose a reason for hiding this comment

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

Could you find a test that exercises this?

@locmai
Copy link
Contributor Author

locmai commented Jul 13, 2022

Could you find a test that exercises this?

The TestAccumulateDeltaToCumulative tests are covering these cases but not with a very high coverage. This is without the tests:

Screenshot_20220713_222120

With the tests, it would be covered:
Screenshot_20220713_222214

However, the tests seem to produce the same all passed result but with less coverage with the incorrect condition:

Screenshot_20220713_222355

Let me add more assertions into that to make it right.

@@ -444,8 +447,9 @@ func TestAccumulateDeltaToCumulative(t *testing.T) {
})
require.Equal(t, mLabels.Len(), vLabels.Len())
require.Equal(t, mValue, vValue)
require.Equal(t, dataPointValue1+dataPointValue2, vValue)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this assertion would fail the bug in comparison between the first and second data points timestamp.

@mx-psi mx-psi changed the title fix: cumulative condition based on the starttimestamp [exporter/prometheus] fix: cumulative condition based on the starttimestamp Jul 18, 2022
@mx-psi mx-psi merged commit f797684 into open-telemetry:main Jul 18, 2022
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.

5 participants