From 877c716d3dd7b9b0c31a8040ff64c7155a6727dc Mon Sep 17 00:00:00 2001 From: Kris O'Mealy Date: Fri, 21 Apr 2023 06:23:14 -0700 Subject: [PATCH] chore: create DeleteMetricMillisBehindLatest to satisfy worker_test implementation error (#3) Signed-off-by: Kris O'Mealy --- clientlibrary/metrics/cloudwatch/cloudwatch.go | 7 +++++++ test/worker_test.go | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/clientlibrary/metrics/cloudwatch/cloudwatch.go b/clientlibrary/metrics/cloudwatch/cloudwatch.go index 7fb66b3..973a733 100644 --- a/clientlibrary/metrics/cloudwatch/cloudwatch.go +++ b/clientlibrary/metrics/cloudwatch/cloudwatch.go @@ -298,6 +298,13 @@ func (cw *MonitoringService) MillisBehindLatest(shard string, millSeconds float6 m.behindLatestMillis = append(m.behindLatestMillis, millSeconds) } +func (cw *MonitoringService) DeleteMetricMillisBehindLatest(shard string) { + m := cw.getOrCreatePerShardMetrics(shard) + m.Lock() + defer m.Unlock() + m.behindLatestMillis = []float64{} +} + func (cw *MonitoringService) LeaseGained(shard string) { m := cw.getOrCreatePerShardMetrics(shard) m.Lock() diff --git a/test/worker_test.go b/test/worker_test.go index 5a87241..50dfcfd 100644 --- a/test/worker_test.go +++ b/test/worker_test.go @@ -338,7 +338,8 @@ func getMetricsConfig(kclConfig *cfg.KinesisClientLibConfiguration, service stri return cloudwatch.NewMonitoringServiceWithOptions(kclConfig.RegionName, kclConfig.KinesisCredentials, kclConfig.Logger, - cloudwatch.DefaultCloudwatchMetricsBufferDuration) + cloudwatch.DefaultCloudwatchMetricsBufferDuration, + ) } if service == "prometheus" {