InfluxDB v0.2.1 InfluxDB

Main interface to query and insert data into InfluxDB.

Summary

Functions

Send a query to InfluxDB and return the result

See :influxdb.query/3

Write one or more points to InfluxDB

See :influxdb.write/3

Types

config()
config() :: InfluxDB.Config.t
fields()
fields() :: %{optional(key) => number | boolean | iodata | atom}
key()
key() :: iodata | atom
measurement()
measurement() :: key
points()
points() :: [point]
query()
query() :: iodata
query_options()
query_options() :: %{optional(:timeout) => timeout, optional(:precision) => time_unit, optional(:retention_policy) => String.t}
query_parameters()
query_parameters() :: %{optional(atom) => atom | String.t | number}
result()
result() :: [series]
series()
series() :: %{:name => String.t, :columns => [String.t], :rows => [tuple], optional(:tags) => %{optional(String.t) => String.t}}
tags()
tags() :: %{optional(key) => iodata | atom}
time_unit()
time_unit ::
  :hour |
  :minute |
  :second |
  :millisecond |
  :microsecond |
  :nanosecond
timestamp()
timestamp() :: integer
write_options()
write_options() :: %{optional(:timeout) => timeout, optional(:precision) => time_unit, optional(:retention_policy) => String.t}

Functions

query(config, query)

Send a query to InfluxDB and return the result.

In case of success, it will return either:

  • :ok, when the query doesn’t have any result set
  • {:ok, [result]}, where result is a list of series, and a series is a map containing the :name, :columns, :rows and :tags keys.

In case of error, it will return either:

  • {:error, {:not_found, description}}}, when the series being queried could not be found
  • {:error, {:server_error, description}}}, when a server error occurs
query(config, query, params)

See :influxdb.query/3.

query(config, query, params, options)
query(config, query, query_parameters, query_options) ::
  :ok |
  {:ok, [result]} |
  {:error, {:not_found, charlist}} |
  {:error, {:server_error, charlist}}

See :influxdb.query/4.

write(config, points)

Write one or more points to InfluxDB.

In case of success, it will return either:

  • :ok, when the write completes successfully

In case of error, it will return either:

  • {:error, {:not_found, description}}}, when the database could not be found
  • {:error, {:server_error, description}}}, when a server error occurs
write(config, points, options)
write(config, points, write_options) ::
  :ok |
  {:error, {:not_found, charlist}} |
  {:error, {:server_error, charlist}}

See :influxdb.write/3.