Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ func init() {
}
}

// report converts and reports collected metrics via OTel metrics
func report() {
// report converts and reports collected metrics via OTel metrics.
// Allow for report to be overridden in the test.
var report = func() {
ctx := context.Background()
for i := 0; i < nMetrics; i++ {
for i := range nMetrics {
metric := metricsBuffer[i]
switch typ := metricTypes[metric.ID]; typ {
case MetricTypeCounter:
Expand Down
3 changes: 3 additions & 0 deletions metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (

// TestMetrics
func TestMetrics(t *testing.T) {
// NOP report to avoid timing-based interference.
report = func() {}

inputMetrics := []Metric{
{IDELFInfoCacheHit, MetricValue(33)},
{IDELFInfoCacheMiss, MetricValue(55)},
Expand Down