mete v0.1.1 Mete View Source

Basic measuring tool and telemetry writer using InfluxDB.

Usage

Add Mete to your application by adding `{:mete, "~> 0.1.1"}` to your list of dependencies in `mix.exs`:

def deps do
  [
    # ...
    {:mete, "~> 0.1.1"}
  ]
end

Options

  • `:host` - hostname of the server running the InfluxDB endpoint, defaults to `localhost`
  • `:port` - port on which the InfluxDB server runs the respective input, defaults to `8089`
  • `:protocol` - either `:udp`, or `:http`. Defaults to `:udp`.
  • `:database` - has to be configured when using `:http`
  • `:tags` - can be used to configure application-wide tags expects a Keywordlist of strings or atoms, defaults to `[]`

ToDo

  • Configurable handling of integer/float values.
  • Configurable handling of timestamps
  • Support for mfa's for measure.

Link to this section Summary

Functions

Evaluates the given function, measures, and subsequently writes the elapsed real time.

Reads the current process tags.

Alters the current process tags according the given keyword list.

Link to this section Types

Link to this section Functions

Link to this function

measure(measurement, tags, fields \\ [], func)

View Source
measure(measurement(), tags(), [Mete.Protocol.field()], (() -> any())) ::
  any()

Evaluates the given function, measures, and subsequently writes the elapsed real time.

iex> measure("query", fn -> "some query result" end)
"some query result"

Reads the current process tags.

Link to this function

tags(keyword)

View Source
tags(tags()) :: :ok

Alters the current process tags according the given keyword list.

The given keyword list will be merged into the existing tags, tags set to `nil` will remove that tag from the tag list.

Link to this function

write(measurement, tags \\ [], fields)

View Source
write(measurement(), tags(), fields() | value()) :: :ok

Writes a measurement.

write("query", [exec: 20, queue: 33])