Kamon Amazon Cloudwatch Extension
(Note: inspired by this repo done by Phil Will. Some code has been reused and modified in this project)
A simple Kamon extension to ship metrics data to Cloudwatch using Amazon's async client.
- add library dependency to your build.sbt
libraryDependencies += "com.timeout" %% "kamon-cloudwatch" % "0.0.1"
- load extension by Akka (optional), by default this module is set to auto-start by calling Kamon.start()
akka {
...
extensions = ["com.timeout.kamon.cloudwatch.KamonCloudWatch"]
}
-
make sure you have AWS_PROFILE or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY pair set correctly
-
add the following to your application.conf and change the fields accordingly:
kamon {
cloudwatch {
# namespace is the AWS Metrics custom namespace
namespace = kamon-cloudwatch
# AWS region, on ec2 region is fetched by getCurrentRegion command
region = eu-west-1
# batch size of data when send to Cloudwatch
batch-size = 20
# only logs metrics to file without shipping out to Cloudwatch if it is false
send-metrics = true
# how many threads will be assigned to the pool that does the shipment of metrics
async-threads = 5
# Subscription patterns used to select which metrics will be pushed to CloudWatch.
# Please Note that, metrics collection entries entities must be activated under the kamon.metrics.filters settings.
# Paste the subscriptions template to your app to configure。
subscriptions {
histogram = [ "**" ]
min-max-counter = [ "**" ]
gauge = [ "**" ]
counter = [ "**" ]
trace = [ "**" ]
trace-segment = [ "**" ]
akka-actor = [
"project/user/userController/**",
"project/user/orderController/**"
]
akka-dispatcher = [ "**" ]
akka-router = [ "**" ]
system-metric = [ "**" ]
http-server = [ "**" ]
akka-http-server = [ "**" ]
}
}
}
- module is set to auto-start by default, you should see "Starting the Kamon CloudWatch extension" in your console output.