From f6608972de8a6dc7e6a7b311bd7cb8633368260b Mon Sep 17 00:00:00 2001 From: Norbert Kwizera Date: Fri, 13 Dec 2024 12:10:40 +0200 Subject: [PATCH] Add CWService interface --- aws/cwatch/base.go | 15 +++++++++++++++ aws/cwatch/service.go | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 aws/cwatch/base.go diff --git a/aws/cwatch/base.go b/aws/cwatch/base.go new file mode 100644 index 0000000..ff661a0 --- /dev/null +++ b/aws/cwatch/base.go @@ -0,0 +1,15 @@ +package cwatch + +import ( + "sync" + + "github.com/aws/aws-sdk-go-v2/service/cloudwatch" + "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types" +) + +type CWService interface { + Queue(d types.MetricDatum) + StartQueue(wg *sync.WaitGroup) + StopQueue() + Prepare(data []types.MetricDatum) *cloudwatch.PutMetricDataInput +} diff --git a/aws/cwatch/service.go b/aws/cwatch/service.go index 02f43db..613104b 100644 --- a/aws/cwatch/service.go +++ b/aws/cwatch/service.go @@ -71,3 +71,5 @@ func (s *Service) processBatch(batch []types.MetricDatum) { slog.Error("error sending metrics to cloudwatch", "error", err, "count", len(batch)) } } + +var _ CWService = (*Service)(nil)