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

Guard for nil data points #2055

Merged

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Nov 4, 2020

Description:
Add a guard for invalid metrics with no data points. The function MetricAndDataPointCount currently panics if the gauge, histogram or sum is nil.

Testing:
I added a unit test and reproduced the issue, making sure the issue is fixed with the test passing.

@atoulme atoulme requested a review from a team November 4, 2020 00:35
@codecov
Copy link

codecov bot commented Nov 4, 2020

Codecov Report

Merging #2055 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2055      +/-   ##
==========================================
+ Coverage   92.05%   92.07%   +0.01%     
==========================================
  Files         278      278              
  Lines       16811    16823      +12     
==========================================
+ Hits        15476    15490      +14     
+ Misses        918      917       -1     
+ Partials      417      416       -1     
Impacted Files Coverage Δ
consumer/pdata/metric.go 99.31% <100.00%> (+0.06%) ⬆️
translator/internaldata/resource_to_oc.go 89.04% <0.00%> (-2.74%) ⬇️
receiver/otlpreceiver/otlp.go 92.30% <0.00%> (+2.56%) ⬆️
service/telemetry.go 85.00% <0.00%> (+3.33%) ⬆️

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 de104da...87f66ca. Read the comment docs.

@bogdandrutu bogdandrutu merged commit 15d2f5b into open-telemetry:master Nov 4, 2020
Troels51 pushed a commit to Troels51/opentelemetry-collector that referenced this pull request Jul 5, 2024
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.

2 participants