项目作者: msoedov

项目描述 :
Graphite client for Elixir
高级语言: Elixir
项目地址: git://github.com/msoedov/graphitex.git
创建时间: 2017-04-12T23:37:57Z
项目社区:https://github.com/msoedov/graphitex

开源协议:MIT License

下载


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:

    1. def deps do
    2. [{:graphitex, "~> 0.1.0"}]
    3. end
  2. Ensure graphitex is started before your application:

    1. def application do
    2. [applications: [:graphitex]]
    3. end
  3. Set up configuration in config.config.exs:

    1. config :graphitex, host: '188.166.101.102', port: 2003
  4. API:

    1. Graphitex.metric(4, "aws.cluster_one.avg_cpu")
    2. # or
    3. Graphitex.metric(4, ["aws", "cluster_one", "avg_cpu"])
    4. # or
    5. 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

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

    likewise there is a shortcut

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

    Insert batch:

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