Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Register metrics in benchmark
Browse files Browse the repository at this point in the history
Currently, the metric we record is not registered. This hits the
fast-path code of not actually recording the metric, so we miss out on
detecting any performance to that main code path.

This registers the metrics so we actually trigger `record`.
  • Loading branch information
howardjohn committed Sep 14, 2021
1 parent fb455b0 commit 3ebabd9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stats/benchmark_test.go
Expand Up @@ -109,5 +109,13 @@ func BenchmarkRecord8_8Tags(b *testing.B) {
}

func makeMeasure() *stats.Int64Measure {
return stats.Int64("m", "test measure", "")
m := stats.Int64("m", "test measure", "")
v := &view.View{
Measure: m,
Aggregation: view.Sum(),
}
if err := view.Register(v); err != nil {
panic(err.Error())
}
return m
}

0 comments on commit 3ebabd9

Please sign in to comment.