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

Remove the confusing package-level variable #2152

Merged
merged 1 commit into from
Nov 20, 2020
Merged

Remove the confusing package-level variable #2152

merged 1 commit into from
Nov 20, 2020

Conversation

rakyll
Copy link
Contributor

@rakyll rakyll commented Nov 14, 2020

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.

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.
@rakyll rakyll requested a review from a team November 14, 2020 00:08
@codecov
Copy link

codecov bot commented Nov 14, 2020

Codecov Report

Merging #2152 (039a33e) into master (3e3b201) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
...iver/prometheusreceiver/internal/metricsbuilder.go 100.00% <100.00%> (ø)
translator/internaldata/resource_to_oc.go 91.54% <0.00%> (+2.81%) ⬆️

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 3e3b201...039a33e. Read the comment docs.

@rakyll
Copy link
Contributor Author

rakyll commented Nov 17, 2020

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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

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

I will do it.

@bogdandrutu bogdandrutu merged commit cc0a999 into open-telemetry:master Nov 20, 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