ex_flux v0.2.0 ExFlux.Database behaviour View Source
Configuration of a single database's connection pool, queue and supervision tree. Since InfluxDB uses a single server UDP port per database, this library's goal is to make it easy to do 1:1 mappings of a pool of UDP connections to that destination's port and batching datapoints.
To get started, create your own module and do something like:
use ExFlux.Database, otp_app: :your_app, database: "your_db_name"
In your application, simply add YourApp.YourExFluxDatabase
to the children:
children = [
...,
YourApp.YourExFluxDatabase
]
The database name isn't used for the UDP connection in anyway, but it is used to create database-specific workers. To support querying interfaces and HTTP based sending, the database would need to be known. To support these features in the future, the database name is held by all workers in their configuration.
Where possible, ExFlux.Database.Supervisor
provides sane defaults for
configuration options to make it as close as working out of the box as
possible. A full list of configuration options and their types can be found
there.
Link to this section Summary
Callbacks
GET query against the /ping endpoint in order to get the status of the
influxdb instance. If the server is alive, we expect a 204 response and will
return :ok
or an {:error, reason}
tuple otherwise
POST to the /query for the configured database. This is used for queries that
mutate the database. See ExFlux.Conn.HTTP.post_query/2
for more details
queue a single data point (may trigger a batch being sent asynchronously)
using the dataabase's http configuration, query the influx database
Link to this section Callbacks
GET query against the /ping endpoint in order to get the status of the
influxdb instance. If the server is alive, we expect a 204 response and will
return :ok
or an {:error, reason}
tuple otherwise
POST to the /query for the configured database. This is used for queries that
mutate the database. See ExFlux.Conn.HTTP.post_query/2
for more details
queue a single data point (may trigger a batch being sent asynchronously)
using the dataabase's http configuration, query the influx database