Skip to content
Elixir AppOptics client
Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
config
lib
test
.formatter.exs
.gitignore
LICENSE
README.md
mix.exs
mix.lock

README.md

AppOptex

CircleCI Hex.pm

Client for AppOptics API, as listed on AppOptics community created language bindings

Installation

The package can be installed by adding app_optex to your list of dependencies in mix.exs:

def deps do
  [
    {:app_optex, "~> 0.1.0"}
  ]
end

Documentation can be found at https://hexdocs.pm/app_optex.

Usage

Uses the APPOPTICS_TOKEN environment variable.

Send a single measurement

  iex> AppOptex.measurement("my.metric", 10, %{my_tag: "value"})
  :ok
  iex> AppOptex.measurement(%{name: "my.metric", value: 10}, %{my_tag: "value"})
  :ok

Send multiple measurements

  iex> AppOptex.measurements([%{name: "my.metric", value: 1}, %{name: "my.other_metric", value: 5}], %{my_tag: "value"})
  :ok

Read metrics

  iex> AppOptex.read_measurements("my.metric", 60, %{duration: 86400})
  %{
    "attributes" => %{"created_by_ua" => "hackney/1.15.1"},
    "links" => [],
    "name" => "my.metric",
    "resolution" => 60,
    "series" => [
      %{
        "measurements" => [%{"time" => 1554720060, "value" => 10.0}],
        "tags" => %{"my_tag" => "value"}
      }
    ]
  }

Set global tags

These tags will be applied to every sent measurement.

  iex> AppOptex.put_global_tags(%{my: "tag"})
  :ok

Read global tags

  iex> AppOptex.get_global_tags()
  %{my: "tag"}

Send using a queue

  iex> AppOptex.push_to_queue([%{name: "my.metric.1", value: 1}], %{test: true})
  :ok
  iex> AppOptex.push_to_queue([%{name: "my.metric.2", value: 1}], %{test: true})
  :ok
  iex> AppOptex.push_to_queue([%{name: "my.metric.3", value: 1}], %{test: true})
  :ok
  iex> AppOptex.flush_queue()
  :ok
You can’t perform that action at this time.