-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove the confusing package-level variable #2152
Conversation
This is unncessarily a package level variable and at the same time, the name is confusing. It should be called "empty" instead of dummy. But no need to have it as a package-level variable, hence this change removes it.
Codecov Report
@@ Coverage Diff @@
## master #2152 +/- ##
==========================================
+ Coverage 92.19% 92.20% +0.01%
==========================================
Files 280 280
Lines 16981 16981
==========================================
+ Hits 15655 15657 +2
+ Misses 908 907 -1
+ Partials 418 417 -1
Continue to review full report at Codecov.
|
Friendly ping. |
@@ -140,7 +138,7 @@ func (b *metricBuilder) AddDataPoint(ls labels.Labels, t int64, v float64) error | |||
func (b *metricBuilder) Build() ([]*metricspb.Metric, int, int, error) { | |||
if !b.hasData { | |||
if b.hasInternalMetric { | |||
return dummyMetrics, 0, 0, nil | |||
return make([]*metricspb.Metric, 0), 0, 0, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this return nil instead of a slice with len 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar enough with the semantics enough here to be confident returning nil and/or an error will be correct behavior. Leaving a TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the todo, did you forget to push the commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do it.
This is unncessarily a package level variable and at the same time, the name is confusing. It should be called "empty" instead of dummy. But no need to have it as a package-level variable, hence this change removes it.