I would like to start using metrics in my Springboot app and I would also like to publish them my amazon cloudwatch
I know that with Springboot we can activate spring-actuator that provides in memory metrics and published them to the /metrics endpoint.
I stumbled across Spring-cloud that seems to have some lib to periodically publish these metrics to Cloudwatch, however I have no clue how to set them up? There is absolutely 0 examples of how to use it.
Anyone could explain what are the step to enable the metric to be sent to cloudwatch?
Spring Cloud for AWS comes into play as an integrator of AWS services. In this tutorial, we'll develop a demo application that integrates with the core services Amazon Simple Storage Service (Amazon S3) and Amazon Simple Queue Service (Amazon SQS).
Step 1 - Create awslogs. conf file to point to the log location. Step 2 - Install cloud watch log agent as part of UserData/Bootstrap script for ec2. Step 3 - Need a role for ec2 machine to create logs in CloudWatch.
Go to https://aws.amazon.com/console/ and login to the AWS Console. Navigate to IAM section->Dashboard->Manage Security Credentials → AccessKeys Tab and extract your Access Key ID and Secret Access Key. Go ahead and Create on if you don't have one. After jotting down the keys, let's install AWS CLI v2 on your system.
Spring Cloud AWS makes AWS a first-class citizen cloud provider for Spring Boot applications. We showed how easy it is to integrate core AWS services like SQS, S3, or the Parameter Store.
Check this conversation:
@sachinlad Indeed the documentation is unfortunately missing, we will create a updated version within the next releases. Do enable the metic export to Cloud Formation, you will need to configure the namespace with the property cloud.aws.cloudwatch.namespace
Have a look at the integration test https://github.com/spring-cloud/spring-cloud-aws/blob/master/spring-cloud-aws-integration-test/src/test/java/org/springframework/cloud/aws/metric/MetricExporterTest.java that is an integration test and export the metrics to cloud formation.
Hope that helps, feel free to come back in case of any problems.
You can check my article here:
https://dkublik.github.io/2017/10/28/springboot-metrics-with-servo-and-aws-cloudwatch.html
I wrote it after setting this up in my project.
From header:
"Article explains how to send Spring Boot and Netflix Servo metrics to AWS CloudWatch. Morover it describes mechanisms making it happen. It also mentions problems I run into trying to do the same with Spring Boot and Spectator."
EDIT: new version: https://dkublik.github.io/2018/08/26/springboot-metrics-with-micrometer-and-aws-cloudwatch.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With