how to pull/push metrics in cloudwatch using client golang

1.3k Views Asked by At

I am writing Kafka(MSK) subscriber(consumer) using GO (golang) and want to push metrics like message consumed count, error count etc. into cloudwatch metrics.

Pushing data directly using AWS-SDK PutMetricData() methods is making the function slow.

1

There are 1 best solutions below

2
Marcin On

If you often publish individual metric data points that can slow you down. The solution proposed by AWS documentation is to use statistical sets:

You can aggregate your data before you publish to CloudWatch. When you have multiple data points per minute, aggregating data minimizes the number of calls to put-metric-data.

This is true for any programming language, whether it is Go or Java. Slowness usually comes from calling the external API to frequently, not due to nature of the language.