Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrmcc3/aws-metrics-collector

Clojure AWS Cloudwatch metric collector
https://github.com/mrmcc3/aws-metrics-collector

aws clojure cloudwatch metrics

Last synced: 25 days ago
JSON representation

Clojure AWS Cloudwatch metric collector

Awesome Lists containing this project

README

        

# aws-metrics-collector (alpha)

Clojure AWS Cloudwatch metric collector.

A collector is a core.async channel that:

* accepts metrics as vanilla clojure data
* drops non-conforming metrics
* batches metrics according to AWS limits
* sends the batches periodically to Cloudwatch using the AWS Java SDK

## Usage

image:https://img.shields.io/clojars/v/mrmcc3/aws-metrics-collector.svg[Clojars]

[source, clojure]
----
{:deps {mrmcc3/aws-metrics-collector
{:git/url "https://github.com/mrmcc3/aws-metrics-collector"
:sha "a16baa17c7b71a684b2085c0e40913315fb85c6b"}}}
----

[source, clojure]
----
(require
'[mrmcc3.aws.metrics.collector :as c]
'[clojure.core.async :as a])

;; define a collector channel with a Cloudwatch metrics namespace
(def collector (c/collector {:namespace "Test"}))

;; put a single metric
(a/put! collector {:name "im-a-metric" :value 3.14})

;; for multiple metrics use a/onto-chan
(a/onto-chan
collector
{:ResponseTime 125
:RenderTime 55.2}
false)

;; close the collector when finished
(a/close! collector)
----

Note by default `collector` will use a default AWS Cloudwatch client
so make sure the you have AWS credentials setup somewhere in the
default chain with the permission to PutMetricData.

See the specs in the code for more info about the collector options
and valid metric data. Dimensions, aggregated statistics,
storage resolution, timestamps and units are all supported!