gfc-aws-cloudwatch


License

License

Apache-style
Categories

Categories

AWS Container PaaS Providers
GroupId

GroupId

com.gilt
ArtifactId

ArtifactId

gfc-aws-cloudwatch_2.10
Last Version

Last Version

1.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

gfc-aws-cloudwatch
gfc-aws-cloudwatch
Project Organization

Project Organization

com.gilt

Download gfc-aws-cloudwatch_2.10

How to add to project

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

Dependencies

compile (5)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.6
com.gilt : gfc-logging_2.10 jar 0.0.7
com.gilt : gfc-concurrent_2.10 jar 0.3.5
com.amazonaws : aws-java-sdk-cloudwatch jar 1.11.78
com.amazonaws : aws-java-sdk-logs jar 1.11.78

test (1)

Group / Artifact Type Version
org.specs2 : specs2-scalacheck_2.10 jar 3.8.6

Project Modules

There are no modules declared in this project.

gfc-aws-cloudwatch Maven Central Join the chat at https://gitter.im/gilt/gfc

A thin Scala wrapper around AWS CloudWatch Java client. Part of the Gilt Foundation Classes.

Getting gfc-aws-cloudwatch

The latest version is 1.3.2, which is cross-built against Scala 2.11.x and 2.12.x

Add dependency to build.sbt:

libraryDependencies += "com.gilt" %% "gfc-aws-cloudwatch" % "1.3.2"

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

Copyright 2019 Hudson's Bay Company

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

com.gilt

Gilt Tech

Versions

Version
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
0.4.0
0.3.0
0.2.0
0.1.1
0.1