kamon-cloudwatch

Kamon extension to publish metrics into AWS CloudWatch

License

License

GroupId

GroupId

com.github.alonsodomin
ArtifactId

ArtifactId

kamon-cloudwatch_2.11
Last Version

Last Version

1.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

kamon-cloudwatch
Kamon extension to publish metrics into AWS CloudWatch
Project URL

Project URL

https://github.com/alonsodomin/kamon-cloudwatch
Project Organization

Project Organization

A. Alonso Dominguez
Source Code Management

Source Code Management

https://github.com/alonsodomin/kamon-cloudwatch

Download kamon-cloudwatch_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.alonsodomin/kamon-cloudwatch_2.11/ -->
<dependency>
    <groupId>com.github.alonsodomin</groupId>
    <artifactId>kamon-cloudwatch_2.11</artifactId>
    <version>1.1.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.alonsodomin/kamon-cloudwatch_2.11/
implementation 'com.github.alonsodomin:kamon-cloudwatch_2.11:1.1.5'
// https://jarcasting.com/artifacts/com.github.alonsodomin/kamon-cloudwatch_2.11/
implementation ("com.github.alonsodomin:kamon-cloudwatch_2.11:1.1.5")
'com.github.alonsodomin:kamon-cloudwatch_2.11:jar:1.1.5'
<dependency org="com.github.alonsodomin" name="kamon-cloudwatch_2.11" rev="1.1.5">
  <artifact name="kamon-cloudwatch_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.alonsodomin', module='kamon-cloudwatch_2.11', version='1.1.5')
)
libraryDependencies += "com.github.alonsodomin" % "kamon-cloudwatch_2.11" % "1.1.5"
[com.github.alonsodomin/kamon-cloudwatch_2.11 "1.1.5"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
io.kamon : kamon-core_2.11 jar 2.1.0
org.slf4j : slf4j-api jar 1.7.30
com.amazonaws : aws-java-sdk-cloudwatch jar 1.11.762

test (6)

Group / Artifact Type Version
io.kamon : kamon-testkit_2.11 jar 2.1.0
org.scalatest : scalatest_2.11 jar 3.1.1
com.github.tomakehurst : wiremock jar 2.25.1
org.apache.logging.log4j : log4j-core jar 2.13.1
org.apache.logging.log4j : log4j-api jar 2.13.1
org.apache.logging.log4j : log4j-slf4j-impl jar 2.13.1

Project Modules

There are no modules declared in this project.

Kamon AWS Cloudwatch Extension

Build Status GitHub release Maven Central Mergify Status

Overview

A simple Kamon extension to ship metrics data to Cloudwatch using Amazon's async client.

Note: This project has been initially forked from Timeout's kamon-cloudwatch but evolved separately as the original one has fallen out of maintenance.

Version Compatibility Matrix

The following table maps Kamon core version with the version of this library:

Kamon Core Kamon CloudWatch Scala JDK
1.0.0 1.0.0 2.10,2.11,2.12 1.8+
2.0.0 1.1.x 2.11,2.12,2.13 1.8+

Getting Started

Add library dependency to your build.sbt

libraryDependencies += "com.github.alonsodomin" %% "kamon-cloudwatch" % "<version>"

The module will be loaded automatically and you should see "Starting the Kamon CloudWatch extension" message in your logs output.

Note: Be sure the box in which this is going to be used, has the proper access credentials to send data to AWS CloudWatch. The preferred approach would be to either use an InstanceProfile or roles in the case of ECS/Docker Containers. Another way would be to have the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set correctly.

Kamon 1.0 users

If using Kamon 1.x, you will need to register it manually during application startup:

val reporter = new CloudWatchReporter()
Kamon.addReporter(reporter)

Configuration

You can configure the module behaviour by overriding any of the following settings in your application.conf file:

kamon {
  cloudwatch {

    # namespace is the AWS Metrics custom namespace
    namespace = <application name>
    
    # (Optional) AWS region, on ec2 region is fetched by getCurrentRegion command
    region = eu-west-1

    # batch size of data when send to Cloudwatch. Default: 20
    batch-size = 20

    # how many threads will be assigned to the pool that does the shipment of metrics. Default: 5
    async-threads = 5
    
    # whether to add Kamon environment tags to each of the metrics. Default: false
    include-environment-tags = false

    # explicit aws access key and secret definition (optional)
    # if not specified values fetched from one of the followings
    #   * AWS_PROFILE env variable
    #   * AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables
    #   * Amazon EC2 Instance Metadata
    # access-key-id = ""
    # secret-access-key = ""

  }
}

AWS Cloudwatch Example

  • log on to Cloudwatch, the metrics will be appearing on 'Custom namespaces' section under "Metrics" menu, i.e.: alt text

License

Versions

Version
1.1.5
1.1.4
1.1.3
1.1.2
1.1.0
1.0.0