InfluxEx (influx_ex v0.3.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
decoder()
Decoder function
This function is ran to decode the body of a response
error()
@type error() :: InfluxEx.ConflictError.t() | InfluxEx.GenericError.t() | InfluxEx.InvalidPayloadError.t() | InfluxEx.NotFoundError.t() | term()
measurement()
@type measurement() :: binary()
The name of a single measurement
query_opt()
@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.
response_links()
@type response_links() :: %{ :self => binary(), optional(:next) => binary(), optional(:prev) => binary() }
Links for a response
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.
tables()
@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.
token()
@type token() :: binary()
The API token to make requests to the InfluxDB API
write_opt()
@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
health(client)
@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.
me(client)
@spec me(InfluxEx.Client.t()) :: {:ok, InfluxEx.Me.t()} | {:error, error()}
Get the current user information
query(client, query, opts \\ [])
@spec query(InfluxEx.Client.t(), binary(), [query_opt()]) :: {:ok, tables()} | {:error, error()}
Send a query to InfluxDB to run
write(client, bucket, point_or_points, opts \\ [])
@spec write( InfluxEx.Client.t(), InfluxEx.Bucket.name(), InfluxEx.Point.t() | [InfluxEx.Point.t()], [ write_opt() ] ) :: :ok
Write one more data point(s) to InfluxDB