Skip to content

mrmcc3/aws-metrics-collector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Clojars

{:deps {mrmcc3/aws-metrics-collector
        {:git/url "https://github.com/mrmcc3/aws-metrics-collector"
         :sha     "a16baa17c7b71a684b2085c0e40913315fb85c6b"}}}
(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!

About

Clojure AWS Cloudwatch metric collector

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published