InfluxElixir.ConnectionSupervisor (InfluxElixir v0.1.21)

Copy Markdown View Source

Per-connection supervisor using :rest_for_one strategy.

Manages a Finch pool and BatchWriter GenServers for a single named InfluxDB connection with crash isolation.

On init, registers the connection config in InfluxElixir.Connection so it can be resolved by name from any process via Connection.fetch!/1 or the facade.

If a Finch pool crashes, all BatchWriters under that connection restart (they depend on the pool). A single BatchWriter crash does NOT take down the pool or sibling writers.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a ConnectionSupervisor for a named connection.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(config)

@spec start_link(keyword()) :: Supervisor.on_start()

Starts a ConnectionSupervisor for a named connection.

Config

  • :name - connection name (atom, required)
  • :host - InfluxDB host (no scheme)
  • :token - authentication token
  • :database - default database for writes/queries
  • :databases - list of database names (see InfluxElixir.Config)
  • :pool_size - Finch connection pool size (default: 10)
  • :batch_writer - keyword options for an InfluxElixir.Write.BatchWriter child; omitted means no writer
  • any other InfluxElixir.Config option (:api_version, :scheme, ...)

When the configured client is InfluxElixir.Client.HTTP the config is validated with InfluxElixir.Config.validate!/1, so a typo such as default_database: fails at startup instead of being silently ignored. InfluxElixir.Client.Local needs no host, so its config is not validated.