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

Refactor the SDK helpers, create MeterImpl #560

Merged
merged 25 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions api/global/internal/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ var Must = metric.Must
// benchFixture is copied from sdk/metric/benchmark_test.go.
// TODO refactor to share this code.
type benchFixture struct {
sdk *sdk.SDK
B *testing.B
sdk *sdk.SDK
meter metric.Meter
B *testing.B
}

var _ metric.Provider = &benchFixture{}
Expand All @@ -35,14 +36,15 @@ func newFixture(b *testing.B) *benchFixture {
B: b,
}
bf.sdk = sdk.New(bf, sdk.NewDefaultLabelEncoder())
bf.meter = metric.WrapMeterImpl(bf.sdk)
return bf
}

func (*benchFixture) AggregatorFor(descriptor *export.Descriptor) export.Aggregator {
func (*benchFixture) AggregatorFor(descriptor *metric.Descriptor) export.Aggregator {
switch descriptor.MetricKind() {
case export.CounterKind:
case metric.CounterKind:
return sum.New()
case export.MeasureKind:
case metric.MeasureKind:
if strings.HasSuffix(descriptor.Name(), "minmaxsumcount") {
return minmaxsumcount.New(descriptor)
} else if strings.HasSuffix(descriptor.Name(), "ddsketch") {
Expand All @@ -66,7 +68,7 @@ func (*benchFixture) FinishedCollection() {
}

func (fix *benchFixture) Meter(name string) metric.Meter {
return fix.sdk
return fix.meter
}

func BenchmarkGlobalInt64CounterAddNoSDK(b *testing.B) {
Expand Down
Loading