gfc-aws-cloudwatch


License

License

Categories

Categories

AWS Container PaaS Providers
GroupId

GroupId

org.gfccollective
ArtifactId

ArtifactId

gfc-aws-cloudwatch_2.12
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

gfc-aws-cloudwatch
gfc-aws-cloudwatch
Project URL

Project URL

https://github.com/gfc-collective/gfc-aws-cloudwatch
Project Organization

Project Organization

org.gfccollective
Source Code Management

Source Code Management

https://github.com/gfc-collective/gfc-aws-cloudwatch.git

Download gfc-aws-cloudwatch_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/org.gfccollective/gfc-aws-cloudwatch_2.12/ -->
<dependency>
    <groupId>org.gfccollective</groupId>
    <artifactId>gfc-aws-cloudwatch_2.12</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.gfccollective/gfc-aws-cloudwatch_2.12/
implementation 'org.gfccollective:gfc-aws-cloudwatch_2.12:2.0.0'
// https://jarcasting.com/artifacts/org.gfccollective/gfc-aws-cloudwatch_2.12/
implementation ("org.gfccollective:gfc-aws-cloudwatch_2.12:2.0.0")
'org.gfccollective:gfc-aws-cloudwatch_2.12:jar:2.0.0'
<dependency org="org.gfccollective" name="gfc-aws-cloudwatch_2.12" rev="2.0.0">
  <artifact name="gfc-aws-cloudwatch_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.gfccollective', module='gfc-aws-cloudwatch_2.12', version='2.0.0')
)
libraryDependencies += "org.gfccollective" % "gfc-aws-cloudwatch_2.12" % "2.0.0"
[org.gfccollective/gfc-aws-cloudwatch_2.12 "2.0.0"]

Dependencies

compile (6)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
org.scala-lang.modules : scala-java8-compat_2.12 jar 0.9.0
org.gfccollective : gfc-logging_2.12 jar 1.0.0
org.gfccollective : gfc-concurrent_2.12 jar 1.0.0
software.amazon.awssdk : cloudwatch jar 2.10.34
software.amazon.awssdk : cloudwatchlogs jar 2.10.34

test (1)

Group / Artifact Type Version
org.specs2 : specs2-scalacheck_2.12 jar 4.8.3

Project Modules

There are no modules declared in this project.

gfc-aws-cloudwatch Maven Central Build Status Coverage Status

A thin Scala wrapper around AWS CloudWatch Java client. A fork and new home of the now unmaintained Gilt Foundation Classes (com.gilt.gfc), now called the GFC Collective, maintained by some of the original authors.

Getting gfc-aws-cloudwatch

The latest version of gfc-aws-cloudwatch using the AWS 1.x libraries is 1.4.1 (maintained on the 1.x branch), The latest version of gfc-aws-cloudwatch using the AWS 2.x libraries is 2.0.0 (maintained on the master branch). Both versions are cross-compiled against Scala 2.12.x and 2.13.x and were released on 21/Jan/2020.

If you're using SBT, add the following line to your build file:

libraryDependencies += "org.gfccollective" %% "gfc-aws-cloudwatch" % "2.0.0"

For Maven and other build tools, you can visit search.maven.org. (This search will also list other available libraries from the GFC Collective.)

Basic usage

Quick metric aggregator example (less flexible than CW APIs but can save costs when you have high-frequency events):

  val cwPublisher = CloudWatchMetricsPublisher.start(1 minute)

  val SubServiceMetricBuilder = {
    CloudWatchMetricDataAggregator.builder(cwPublisher).withMetricNamespace("TopLevelNamespace")
  }

  val Count = SubServiceMetricBuilder.withUnit(StandardUnit.Count)

  val SuccessCount = Count.withMetricName("success")

  def kind = new Dimension().withName("kind")

  val SuccessfulCreate = SuccessCount.addDimensions(kind.withValue("create"))

  val SuccessfulUpdate = SuccessCount.addDimensions(kind.withValue("update"))

  val SuccessfulCreateFoo = SuccessfulCreate.enterMetricNamespace("foo").start()
  val SuccessfulUpdateFoo = SuccessfulUpdate.enterMetricNamespace("foo").start()

  val SuccessfulCreateBar = SuccessfulCreate.enterMetricNamespace("bar").start()
  val SuccessfulUpdateBar = SuccessfulUpdate.enterMetricNamespace("bar").start()

..........

  SuccessfulCreateFoo.increment()
  SuccessfulUpdateFoo.increment()
  .....

Quick example:

implicit
object FooMetricToCloudWatchMetricsData
  extends ToCloudWatchMetricsData[Foo] {

  override
  def toMetricData( t: Foo
                  ): Seq[MetricDatum] = {
    // convert to metric data
  }
}

// ..........

CloudWatchMetricsClient("TopLevelNamespace").
  enterNamespace("foo"). // optionally enter more specific namespace
  putMetricData(someFoo)


implicit
object FooMetricToCloudWatchLogsData
  extends ToCloudWatchLogsData[Foo] {

  override
  def toLogEvents( t: Foo
                  ): Seq[InputLogEvent] = {
    // convert to log events
  }
}

// ..........

CloudWatchLogsClient("TopLevelNamespace").
  enterNamespace("foo"). // optionally enter more specific namespace
  putLogData("streamName", someFoo)

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

org.gfccollective

The GFC Collective

The new home of the (former) Gilt Foundation Classes

Versions

Version
2.0.0
1.4.1
1.4.0