InfluxEx (influx_ex v0.2.1)

Functions for working with the primary Influx v2.x API

Link to this section Summary

Types

Decoder function

The name of a single measurement

Options used to query InfluxDB

Links for a response

Returned when a list of a resource is returned by the API

Tables are returned when querying InfluxDB

The API token to make requests to the InfluxDB API

Options for writing data points to InfluxDB

Functions

Get the health of the server

Get the current user information

Send a query to InfluxDB to run

Write one more data point(s) to InfluxDB

Link to this section Types

@type decoder() :: (iodata() -> {:ok, term()} | {:error, term()})

Decoder function

This function is ran to decode the body of a response

Link to this type

measurement()

@type measurement() :: binary()

The name of a single measurement

@type query_opt() :: {:org, InfluxEx.Org.name()} | {:org_id, InfluxEx.Org.id()}

Options used to query InfluxDB

When querying InfluxDB, you must either provide an org name or an org id, if both are provided the org name takes precedence.

If you configured your InfluxDB.Client.t() with an :org field, that value will be used by default. Otherwise, you must provide one of these values.

Link to this type

response_links()

@type response_links() :: %{
  :self => binary(),
  optional(:next) => binary(),
  optional(:prev) => binary()
}

Links for a response

Link to this type

response_list(resource)

@type response_list(resource) :: %{
  :links => response_links(),
  optional(atom()) => [resource]
}

Returned when a list of a resource is returned by the API

For example, when you send a request to the /buckets endpoint you will get a list of buckets along with various response links.

@type tables() :: %{required(integer()) => [InfluxEx.TableRow.t()]}

Tables are returned when querying InfluxDB

Tables is map with integer key (the table) and a list of InfluxEx.TableRow.t()s as the value. You can think of each table as a new dataset. Normally, when the results are many tables, you have not filtered a tag out in your Flux query.

@type token() :: binary()

The API token to make requests to the InfluxDB API

@type write_opt() :: {:precision, System.time_unit()} | {:org, InfluxEx.Org.name()}

Options for writing data points to InfluxDB

When writing to InfluxDB, you must either provide an org name or an org id, if both are provided the org name takes precedence.

If you configured your InfluxDB.Client.t() with an :org field, that value will be used by default. Otherwise, you must provided one of these values.

Link to this section Functions

@spec health(InfluxEx.Client.t()) :: :ok | {:error, error()}

Get the health of the server

Returns :ok if the server is ready to receive read and writes.

@spec me(InfluxEx.Client.t()) :: {:ok, InfluxEx.Me.t()} | {:error, error()}

Get the current user information

Link to this function

query(client, query, opts \\ [])

@spec query(InfluxEx.Client.t(), binary(), [query_opt()]) ::
  {:ok, tables()} | {:error, error()}

Send a query to InfluxDB to run

Link to this function

write(client, bucket, point_or_points, opts \\ [])

Write one more data point(s) to InfluxDB