{"id":20118236,"url":"https://github.com/samsara/trackit","last_synced_at":"2025-05-06T14:31:27.386Z","repository":{"id":29461662,"uuid":"32998130","full_name":"samsara/trackit","owner":"samsara","description":"TRACKit! A developer friendly wrapper for Yammer's Metrics library in Clojure.","archived":false,"fork":false,"pushed_at":"2019-10-02T20:07:41.000Z","size":165,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-28T13:39:52.359Z","etag":null,"topics":["clojure","ganglia","graphite","influxdb","jvm-metrics","metrics","newrelic","riemann","statsd"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samsara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-27T16:51:14.000Z","updated_at":"2022-10-13T22:02:49.000Z","dependencies_parsed_at":"2022-08-25T12:51:30.622Z","dependency_job_id":null,"html_url":"https://github.com/samsara/trackit","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsara%2Ftrackit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsara%2Ftrackit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsara%2Ftrackit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsara%2Ftrackit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samsara","download_url":"https://codeload.github.com/samsara/trackit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224447260,"owners_count":17312801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","ganglia","graphite","influxdb","jvm-metrics","metrics","newrelic","riemann","statsd"],"created_at":"2024-11-13T19:09:52.594Z","updated_at":"2024-11-13T19:09:53.384Z","avatar_url":"https://github.com/samsara.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TRACKit!\n\nA Clojure developer friendly wrapper for Yammer's Metrics library.\nThe objective of this library is to try to make as simple as possible\nto track metrics inside your app.\n\nIt can publish the metrics in any of the following systems:\n\n  - Console\n  - Ganglia\n  - Graphite\n  - Statsd\n  - Infuxdb\n  - Reimann\n  - NewRelic\n  - AWS Cloudwatch\n  - Prometheus\n  - JMX Beans\n\n## How to build\n\nTo build all the packages at once run:\n\n``` bash\n./bin/lein-all.sh do clean, check, install\n```\n\n## Usage\n\nTo use TRACKit! you need to add the following dependency to your\n`project.clj` file.\n\n```\n[samsara/trackit-all \"0.9.3\"]\n```\n\nLatest version: [![Clojars Project](https://img.shields.io/clojars/v/samsara/trackit-all.svg)](https://clojars.org/samsara/trackit-all)\n\n\nLoad the namespace in the REPL\n\n```clojure\n(use 'samsara.trackit)\n```\nor as part of your namespace\n\n```clojure\n(ns my.project\n  (:require [samsara.trackit :refer :all]))\n```\n\nNow you can start count, track rates, track values etc.\n\n### Counting things\n\nThe function `count-tracker` is used to produce counters.\nA counter is a monotonically increasing (or decreasing) number. All counters are updated atomically.\nIt returns a function which traces the number of times it is called or the number of items seen.\n\nUsage example:\n\n```clojure\n ;; create the counter\n (def track-orders (count-tracker \"myapp.orders.processed\"))\n\n ;; use the counter\n (defn mark-order-as-processed [\u0026 args]\n   (track-orders) ;; increment and report the counter\n   (comment do something else))\n\n```\n\nWhen called without arguments it atomically increments the counter by 1. If you call the function with a number will increment the counter by that number.\n\nExample:\n\n```clojure\n ;; create the counter\n (def track-order-items (count-tracker \"myapp.items.processed\"))\n\n ;; use the counter\n (defn mark-order-as-processed [{items :items :as order}]\n   (track-order-items (count items)) ;; increment and report the counter\n   (comment do something else))\n```\n\nA convenience fucntion is also available which counts the number of time the body is executed. A counter is a monotonically increasing number. All counters are updated atomically.\n\n```clojure\n;; use the counter\n(defn mark-order-as-processed [\u0026 args]\n  (track-count \"myapp.orders.processed\")\n  (comment do something else))\n\n;; use the counter with a give increment\n(defn process-order [{items :items :as order}]\n  (track-count \"myapp.orders.items.count\" (count items))\n  (comment do something else))\n\n```\n\nIf you are only interested in counting how many times a piece of code\nis executed then you can use the following macro.\n\n```Clojure\n;; use the counter\n(defn mark-order-as-processed [\u0026 args]\n  (track-pass-count \"myapp.orders.processed\"    ;; count body executions\n    (comment do something else)))\n```\n\n### Tracking current value of something\n\nTo track a value which can vary over time you can use the `track-value-of` function.\nIt tracks the current value of a function. This is useful to measure stats at regular intervals, such as the number of active users, the connection pool size, the number of pending requests etc.\n\n```clojure\n ;; initialize tracker\n (track-value-of \"db.connection.pool.size\"\n   (fn [] (get-current-pool-size db-pool)))\n```\n\nOnce initialized it will be reported at regular intervals, typically every 10s (reporter configuration) which means that every ~10s a call to the tracker-fn will be made in a separate thread.\n\nIf you have a function which returns a value which you want to track,\nthen you can use the marco which shortens the code.\nIt tracks the current value of a function. This is useful to measure stats at regular intervals, such as the number of active users, the connection pool size, the number of pending requests etc. It is the same as track-value-of, it's just a convenience macro which wraps the body into a function.\n\n```clojure\n ;; initialize tracker\n (track-value \"db.connection.pool.size\"\n   (get-current-pool-size db-pool))\n```\n\n## Tracking how often something happens (rate)\n\nIf you have to track the frequency of something, you can use the `rate-tracker`.\nIt returns a function which tracks how often an event happens. It is useful to track things such as: number of request per second, number of db-query per second, number of orders per minute etc.\n\nusage:\n\n```clojure\n;; initialize tracker\n(def track-request-rate (rate-tracker \"myapp.user.requests\"))\n\n;; in your request handler\n(defn request-handler [req]\n  (track-request-rate)\n  (comment handle the request))\n```\n\nIf you are handling a batch of item rather than a single request you\ncan pass the a number in the returned function like:\n\n```clojure\n(def track-documents-rate (rate-tracker \"myapp.indexer.documents.indexed\"))\n\n(defn store-documents [ documents-batch ]\n  (track-documents-rate (count documents-batch))\n  (comment then do store the batch of documents in db))\n```\n\nYou can inline your tracker in with the `track-rate` function.\n\n```clojure\n;; in your request handler\n(defn request-handler [req]\n  (track-rate \"myapp.user.requests\")\n  (comment handle the request))\n```\n\nHere with an arbitrary size.\n\n```clojure\n;; track the number of doc indexed\n(defn index-documents [documents]\n  (track-rate \"myapp.document.indexed\" (count documents))\n  (comment handle the request))\n```\n\nWith the macro you can do the same over the execution of a block of\ncode.  It tracks the rate of the body execution. It is useful to track\nthings such as: number of request per second, number of db-query per\nsecond, number of orders per minute etc.\n\nusage:\n\n```clojure\n  ;; in your request handler\n  (defn request-handler [req]\n    (track-pass-rate \"myapp.user.requests\"\n      (comment handle the request)))\n```\n\n### Tracking a distribution (histograms/percentiles)\n\nIf you want to know the average of some quantity then the distribution\ntracker provides a better result.  `distribution-tracker` returns a\nfunction which takes a value as parameter and it tracks its\ndistribution.  Whenever you are looking for an average, an histogram\ngives you more information. So rather than looking at:\n\n*The average search result is 120 items*\n\nwith a distribution you get something like:\n\n*75% of all searches returned 100 or fewer results, while 95% got 200 or fewer.*\n\nusage:\n\n```clojure\n ;; initialize tracker\n (def track-search-results (distribution-tracker \"myapp.search.results\"))\n\n ;; track searches\n (defn my-search [query]\n   (let [results (execute query)\n         _       (track-search-results (count results)]\n     results)))\n```\n\nAgain you can achieve the same with the convenience function.\nIf you have a code block which return a collection or a number\nyou can track the distribution as:\n\n```clojure\n;; track searches\n(defn my-search [query]\n  (let [results (execute query)]\n    (track-distribution \"myapp.search.results\" (count results))\n    results))\n```\n\nTypically the thing you want to track is going to be either\na straight number or something countable.\nSo rather than having to wrap the the result into a let,\nyou can pass the \"thing\" you want to track as the `value`\nparameter. If it is a number it will use its value,\nif values is a `seq`, a collection or anything you can `count`\non it, it will run `(count value)` or an exception will be raised.\nFinally the `value` will be returned as result of the function.\nThe following code is equivalent to the previous one,\nbut much clearer.\n\n```clojure\n;; track searches\n(defn my-search [query]\n  (track-distribution \"myapp.search.results\"\n    (execute query)))\n```\n\nIt returns the result of the `body` execution.\n\n\n### Tracking how long it takes to do something\n\nIf you want to track how long a query takes then a macro similar to `time` will provide what you are looking for.\n`track-time` tracks the distribution of the time it takes to execute the body and the rate at which it is processed.\n\nThis is useful to measure things such as: the time it takes to query the database, or to process a request, or to send a request to another services. Anytime you what to know about how long it takes to run a part of your code use this tracker.\n\n```clojure\n (track-time \"myapp.db.search\"\n   (let [connection (get-connection db)]\n     (db-query connection a-query)))\n```\nIt returns the result of body execution.\n\n### Read the stats\n\nTo obtain the current value of all the metrics you are collecting\nyou can use `all-metrics` which will return a list with all metrics.\n\nWith `show-stats` you'll be able to print all the metrics in the std-output\nin a tabular format. By default it displays a short version. For a more\ncomplete output use:\n\n```clojure\n\n;; get the list of all metrics\n(def metrics (all-mentrics))\n\n;; display stats wil only main metrics values\n(show-stats)\n\n;; display stats with more details\n(show-stats :full)\n```\n\n### JVM Instrumentation\n\nTRACKit! is able to publish metrics about the running JVM.\nThis can be controlled via the `:jvm-metrics` which can be\neither `:all` or you can provide a list of JVM metrics you are\ninterested in. (**by default `:all` metrics are instrumented**)\n\nExample:\n\n\n```clojure\n(start-reporting!\n   {:type        :console\n    ;; publish jvm metrics as well\n    :jvm-metrics :all\n    })\n```\n\nAlternatively you can specify which set of metrics you are\ninterested in:\n\n```clojure\n(start-reporting!\n   {:type        :console\n    ;; publish jvm metrics groups listed below\n    :jvm-metrics [:memory :files :gc :threads :attributes]\n    })\n```\n\nFor more reporting information look at the next section.\n\nIf you wish to disable the JVM metrics instrumentation,\nthen set `:jvm-metrics` to `:none`.\n\n```clojure\n(start-reporting!\n   {:type        :console\n    ;; to disable metrics instrumentation\n    :jvm-metrics :none\n    })\n```\n\nFor JDK9+, you might need to change this setting, see the [troubleshooting](./doc/troubleshooting.md) page.\n\n\n### Start reporting\n\nTRACKit! supports several reporting methods.\n\nReporting is activated with:\n\n```clojure\n(def r (start-reporting! cfg))\n```\n\nThe configuration will contain a element `:type` which will define\nwhich backend system will be used to report the metrics.\nEach different backend has a different set of configuration options.\nSee here the details.\n\nTo stop the reporter:\n\n```clojure\n;; stop the reporter\n(r)\n```\n\n#### Console\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :console\n    ;; how often the stats will be displayed\n    :reporting-frequency-seconds 300\n    ;; which output stream should be used stdout or stderr\n    :stream                      (System/err)\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS })\n```\n\n#### Graphite\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-graphite \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :graphite\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 10\n    ;; graphite host and port\n    :host                        \"localhost\"\n    :port                        2003\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics\n    :prefix                      \"trackit\"})\n```\n\n#### Statsd\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-statsd \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :statsd\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 10\n    ;; statsd host and port\n    :host                        \"localhost\"\n    :port                        8125\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics\n    :prefix                      \"trackit\"})\n```\n\n#### Riemann\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-riemann \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :riemann\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 10\n    ;; riemann host and port\n    :host                        \"localhost\"\n    :port                        5555\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics\n    :prefix                      \"trackit\"\n    ;; local hostname\n    :host-name                   \"node1\"})\n```\n\n#### Ganglia\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-ganglia \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :ganglia\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 60\n    ;; ganglia host and port\n    :host                        \"localhost\"\n    :port                        8649\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics\n    :prefix                      \"trackit\"})\n```\n\n#### InfluxDB\n\nTo report to InfluxDB use the `:influxdb` reporter.\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-influxdb \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :influxdb\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 10\n    ;; influxdb host and port\n    :host                        \"localhost\"\n    :port                        8086\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics\n    :prefix                      \"trackit\"\n    ;; influx specific params\n    :db-name \"metrics\"         ;; must already exist\n    :auth \"username:password\"  ;; if required\n    ;; additional (optional) tags\n    :tags {\"host\" \"node1\", \"version\" \"1.2.3\"}\n    })\n```\n\n#### Grafana / InfluxDB via Riemann\n\nTo report to Grafana and InfluxDB use Riemann as collector.\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-riemann \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :riemann\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 10\n    ;; riemann host and port\n    :host                        \"localhost\"\n    :port                        5555\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics\n    :prefix                      \"trackit\"})\n```\n\nIn your Grafana / InfluxDB server start a Riemann server with\nthe following configuration to forward your metrics to InfluxDB\n\n``` clojure\n\n(logging/init  {:file \"/var/log/riemann.log\"})\n\n; Listen on the local interface over TCP (5555), UDP (5555), and websockets\n; (5556)\n(let  [host \"0.0.0.0\"]\n  (tcp-server  {:host host})\n  (udp-server  {:host host})\n  (ws-server  {:host host}))\n\n; Expire old events from the index every 5 seconds.\n(periodically-expire 5)\n\n(let  [index  (index)\n       influx (influxdb {:host \"127.0.0.1\" :port 8086 :db \"dbname\"\n                         :username \"admin\" :password \"admin\"\n                         :series #(:service %)\n                         :version :0.9\n                         })]\n\n  ; Inbound events will be passed to these streams:\n  (streams\n    ;We are not interested in events from riemann's servers\n    ;i.e the tcp-server udp-server and ws-server above\n    (where (not  (service #\"^riemann .+\"))\n\n      (default :ttl 60\n        ; Index\n        index\n\n        ;for now, log em\n        #(info %)\n\n        ;send to influxdb\n        influx\n\n        ;Log expired events.\n        (expired\n          (fn [event] (info \"EXPIRED\" event)))))))\n\n```\n\n#### NewRelic\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-newrelic \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :newrelic\n    ;; how often the stats will be reported to the server\n    :reporting-frequency-seconds 30\n    ;; set the reported name\n    :reporter-name               \"trackit-reporter\"\n    ;; Whether a specific metric attribute should be published to NewRelic or not.\n    ;; It takes a function which takes in input the `name` of the metric and the\n    ;; attribute (keyword) and it returns `true`/`false` whether it should be pulished.\n    ;; by default it publishes everything.\n    :metrics-attribute-filter    (constantly true)\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; prefix to add to all metrics (slash separated)\n    :prefix                      \"trackit/\"})\n```\n\n**NOTE:** that to use this reporter you need to download and run the NewRelic java agent\nas described in the [NewRelic documentaion](https://docs.newrelic.com/docs/agents/java-agent/installation/java-agent-manual-installation).\n\n[NewRelic custom metrics best practices](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/custom-metrics#best_practices) recommends\nto keep the number of custom metrics under 2000.  For this purpose you\ncan use the `:metrics-attribute-filter` option which takes a function\nwith two arguments: the metrics `name` and the attribute type. The\nattribute type is one of the following keywords:\n\n``` clojure\n(def ^:const all-metrics-attributes\n  #{:timer-min\n    :timer-max\n    :timer-mean\n    :timer-std-dev\n    :timer-median\n    :timer75th-percentile\n    :timer95th-percentile\n    :timer98th-percentile\n    :timer99th-percentile\n    :timer999th-percentile\n    :timer-count\n    :timer-mean-rate\n    :timer1-minute-rate\n    :timer5-minute-rate\n    :timer15-minute-rate\n    :histogram-min\n    :histogram-max\n    :histogram-mean\n    :histogram-std-dev\n    :histogram-median\n    :histogram75th-percentile\n    :histogram95th-percentile\n    :histogram98th-percentile\n    :histogram99th-percentile\n    :histogram999th-percentile\n    :meter-count\n    :meter-mean-rate\n    :meter1-minute-rate\n    :meter5-minute-rate\n    :meter15-minute-rate\n    :counter-count\n    :gauge-value})\n```\n\nSo if you are interested only in the `999th-percentiles` for timers\nand histograms you can write a function which looks like this:\n\n``` clojure\n(defn my-filter [name type]\n  (#{:timer999th-percentile\n     :histogram999th-percentile\n     :meter-count\n     :meter1-minute-rate\n     :counter-count\n     :gauge-value} type))\n```\n\nThis function will return `true` only when the type is one of the listed types.\nFinally you have to pass this function as `:metrics-attribute-filter my-filter`.\n\n\n#### Cloudwatch\n\nNOTE: AWS costs money, please always consider the following\n* How many metrics you are sending.\n* How often you are sending them.\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-cloudwatch \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :cloudwatch\n    ;; The custom namespace in cloudwatch under which metrics will be published\n    :namespace                   \"trackit\"\n    ;; how often the stats will be reported to Cloudwatch, set to AWS default of 5 mins\n    :reporting-frequency-seconds 300\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; Global dimensions (optional) that are applied to all metrics\n    :global-dimensions           {\"host\" \"node1\", \"version\" \"1.2.3\"}})\n```\n\n\n#### Prometheus\n\nTRACKit sends metrics to prometheus using the 'Prometheus Push Gateway'.\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-prometheus \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :prometheus\n     ;; set the reported name\n    :reporter-name               \"trackit-reporter\"\n    ;; how often the stats will be reported to Prometheus\n    :reporting-frequency-seconds 300\n    ;; the url for the prometheus push gateway\n    :push-gateway-url            \"http://localhost:9091\"\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS\n    ;; if true it add a `:pid` as grouping key with a UUID unique per process\n    ;; this is useful to get metrics by process when multiple redundant instances\n    ;; are running and pushing metrics to the same PushGateway\n    :inject-pid?                 true\n    ;; Grouping Keys (optional) that are sent with all metrics\n    ;; Prometheus only allows alphanumerals and underscores for\n    ;; both keys and values of grouping-keys. All other characters\n    ;; will be replaced with an underscore before reporting to\n    ;; Prometheus\n    :grouping-keys              {\"host\" \"node1\", \"version\" \"1_2_3\"}})\n```\n\n\n#### JMX\n\nTRACKit exposes metrics via JMX using the 'JMXReporter'.\n\nAdd the following dependency to your `project.clj`\n\n``` clojure\n;; use same version as trackit-core\n[samsara/trackit-jmx \"0.9.3\"]\n```\n\nAnd then start your reporting with:\n\n\n```clojure\n(import 'java.util.concurrent.TimeUnit)\n\n(start-reporting!\n   {:type                        :jmx\n    ;; set the reported domain\n    :domain                      \"trackit\"\n    ;; unit to use to display rates\n    :rate-unit                   TimeUnit/SECONDS\n    ;; unit to use to display durations\n    :duration-unit               TimeUnit/MILLISECONDS}})\n```\n\n### Selectively import reporters.\n\nReporters and their dependencies are distributed into separate JAR files.\nHere a breakdown of the different packages.\n\n  * `[samsara/trackit-core       \"x.y.z\"]` - core api, always required\n  * `[samsara/trackit-ganglia    \"x.y.z\"]` - required only when reporting to Ganglia\n  * `[samsara/trackit-graphite   \"x.y.z\"]` - required only when reporting to Graphite\n  * `[samsara/trackit-influxdb   \"x.y.z\"]` - required only when reporting to InfluxDB\n  * `[samsara/trackit-cloudwatch \"x.y.z\"]` - required only when reporting to AWS Cloudwatch\n  * `[samsara/trackit-newrelic   \"x.y.z\"]` - required only when reporting to NewRelic\n  * `[samsara/trackit-riemann    \"x.y.z\"]` - required only when reporting to Riemann\n  * `[samsara/trackit-statsd     \"x.y.z\"]` - required only when reporting to Statsd\n  * `[samsara/trackit-prometheus \"x.y.z\"]` - required only when reporting to prometheus\n  * `[samsara/trackit-jmx        \"x.y.z\"]` - required only when reporting via jmx\n  * `[samsara/trackit-all        \"x.y.z\"]` - use this one if you want bind them all in single dependency.\n\nLatest version: [![Clojars Project](https://img.shields.io/clojars/v/samsara/trackit-all.svg)](https://clojars.org/samsara/trackit-all)\n\n\n## License\n\nCopyright © 2015-2018 Samsara's authors.\n\nDistributed under the Apache License v 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsara%2Ftrackit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamsara%2Ftrackit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsara%2Ftrackit/lists"}