/graphitex

Graphite client for Elixir

Primary LanguageElixirMIT LicenseMIT

Graphitex

Graphite client for Elixir with zero dependencies

MIT licensed Hex Version Build Status

Installation

If available in Hex, the package can be installed as:

  1. Add graphitex to your list of dependencies in mix.exs:
def deps do
  [{:graphitex, "~> 0.1.0"}]
end
  1. Ensure graphitex is started before your application:
def application do
  [applications: [:graphitex]]
end
  1. Set up configuration in config.config.exs:
config :graphitex, host: '188.166.101.102', port: 2003
  1. API:
Graphitex.metric(4, "aws.cluster_one.avg_cpu")
# or
Graphitex.metric(4, ["aws", "cluster_one", "avg_cpu"])
# or
Graphitex.metric(41.0, [:aws, :cluster_one, :avg_cpu])

by default :os.system_time(:seconds) used as timestamp, but you can pass ts as an argument

Graphitex.metric(41, "aws.cluster_one.avg_cpu",:os.system_time(:seconds))

likewise there is a shortcut

Graphitex.metric(41, "aws.cluster_one.avg_cpu", Graphitex.now)

Insert batch:

 [{4, "client.transactions.east"},
  {2, "client.transactions.west"},
  {5, "client.transactions.north", Graphitex.now}
 ]
|> Graphitex.metric_batch(batch)