-
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
Add misc changes for metrics correctness #1453
Add misc changes for metrics correctness #1453
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1453 +/- ##
==========================================
+ Coverage 91.42% 91.44% +0.01%
==========================================
Files 248 248
Lines 17219 17226 +7
==========================================
+ Hits 15743 15752 +9
+ Misses 1064 1063 -1
+ Partials 412 411 -1
Continue to review full report at Codecov.
|
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.
Reviewed first 2 files, then got stuck. Would be good to:
- Either split in smaller PRs with 1 line description
- OR Add more detailed description about what to expect in this PR :)
internal/goldendataset/metric_gen.go
Outdated
return NewMetricGenerator().GenMetricDataFromCfg(cfg) | ||
} | ||
|
||
type MetricGenerator struct { |
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.
Does this need to be exported?
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.
Fixed
internal/goldendataset/metric_gen.go
Outdated
metricID int | ||
} | ||
|
||
func NewMetricGenerator() *MetricGenerator { |
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.
same, can this be package private?
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.
Fixed
@bogdandrutu Thanks for taking a look. I have added a more detailed explanation of the contents of this PR. |
type metricGenerator struct { | ||
metricID int | ||
} | ||
|
||
func newMetricGenerator() *metricGenerator { | ||
return &metricGenerator{} | ||
} |
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.
Is this whole type needed? You can just pass around metricID.
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.
metricID
is a counter that gets incremented every time a new metric is generated. It's used to create unique metric names. I guess we could hold and increment the current count on the stack, but it would be a more complicated solution than this.
Rebase? |
Done. |
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.
Making progress.
@@ -172,13 +173,20 @@ func (mb *MockBackend) ConsumeMetricOld(md consumerdata.MetricsData) { | |||
} | |||
} | |||
|
|||
type TraceDualConsumer interface { | |||
consumer.TraceConsumer | |||
consumer.TraceConsumerOld |
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.
Why do you need the Old interface?
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.
To answer this and the next question, the old interface is used by Prometheus and OpenCensus on the metrics side, and Zipkin on the tracing side.
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.
That is no longer true :) for 2 out of 3 :)
@@ -243,29 +251,28 @@ func (tc *MockTraceConsumer) ConsumeTraceData(ctx context.Context, td consumerda | |||
return nil | |||
} | |||
|
|||
type MetricsDualConsumer interface { | |||
consumer.MetricsConsumer | |||
consumer.MetricsConsumerOld |
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.
Same.
} | ||
|
||
var _ TraceDualConsumer = (*MockTraceConsumer)(nil) | ||
|
||
type MockTraceConsumer struct { |
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.
Does this need to be public?
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.
Yes, it will be used by the test harness in the metrics package as a placeholder trace consumer.
Please rebase |
Done. |
…1453) * Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.6.1...v1.7.0) Signed-off-by: dependabot[bot] <support@github.com> * Auto-fix go.sum changes in dependent modules * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This is in support of issue #652.
This change:
correctness
package so that they can be used from themetrics
subdirectory/package.MockTraceConsumer
andMockMetricsConsumer
with the interfacesMetricsDualConsumer
andTraceDualConsumer
, both of which can consume old and new metrics/traces. This will be used in a forthcomingTestHarness
type that implementsMetricsDualConsumer
.PrometheusDataReceiver
and aPrometheusDataSender
so that Prometheus correctness can be tested.