Skip to content

Commit

Permalink
add unit test for new metric
Browse files Browse the repository at this point in the history
Signed-off-by: Ziqi Zhao <[email protected]>
  • Loading branch information
fatsheep9146 committed Jun 26, 2022
1 parent ce21dda commit c2b5f0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exporter/exporterhelper/queued_retry_inmemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (qrs *queuedRetrySender) start(context.Context, component.Host) error {
return fmt.Errorf("failed to create retry queue size metric: %w", err)
}
err = globalInstruments.queueCapacity.UpsertEntry(func() int64 {
return int64(qrs.queue.Capacity())
return int64(qrs.cfg.QueueSize)
}, metricdata.NewLabelValue(qrs.fullName))
if err != nil {
return fmt.Errorf("failed to create retry queue capacity metric: %w", err)
Expand Down
1 change: 1 addition & 0 deletions exporter/exporterhelper/queued_retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ func TestQueuedRetry_QueueMetricsReported(t *testing.T) {
require.NoError(t, be.sender.send(newErrorRequest(context.Background())))
}
checkValueForGlobalManager(t, defaultExporterTags, int64(7), "exporter/queue_size")
checkValueForGlobalManager(t, defaultExporterTags, int64(5000), "exporter/queue_capacity")

assert.NoError(t, be.Shutdown(context.Background()))
checkValueForGlobalManager(t, defaultExporterTags, int64(0), "exporter/queue_size")
Expand Down

0 comments on commit c2b5f0f

Please sign in to comment.