From 9ca9d901ca8dde26c25cc5365c780b605fef8955 Mon Sep 17 00:00:00 2001 From: Tao Jiang Date: Mon, 11 Nov 2019 14:11:44 -0600 Subject: [PATCH] Fix error in puslishing cloud watch metrics (#55) Reported at: https://github.com/vmware/vmware-go-kcl/issues/54 The input params are not used to set monitor service in cloudwatch Init function. The empty appName, streamName and workerID cause PutMetricData failed with error string "Error in publishing cloudwatch metrics. Error: InvalidParameter...". Signed-off-by: Tao Jiang --- clientlibrary/metrics/cloudwatch/cloudwatch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clientlibrary/metrics/cloudwatch/cloudwatch.go b/clientlibrary/metrics/cloudwatch/cloudwatch.go index 9572579..3fea191 100644 --- a/clientlibrary/metrics/cloudwatch/cloudwatch.go +++ b/clientlibrary/metrics/cloudwatch/cloudwatch.go @@ -89,6 +89,10 @@ func NewMonitoringServiceWithOptions(region string, creds *credentials.Credentia } func (cw *MonitoringService) Init(appName, streamName, workerID string) error { + cw.appName = appName + cw.streamName = streamName + cw.workerID = workerID + cfg := &aws.Config{Region: aws.String(cw.region)} cfg.Credentials = cw.credentials s, err := session.NewSession(cfg)