InfluxElixir.Client.HTTP (InfluxElixir v0.1.16)

Copy Markdown View Source

Production InfluxDB client implementation using Finch.

Communicates with real InfluxDB v3 (and v2) instances over HTTP. Uses Finch connection pools for efficient HTTP/1.1 and HTTP/2.

Connection

The connection parameter is a keyword list containing at minimum :host, :token, :scheme, :port, and a :name atom used to resolve the Finch pool. These are typically produced by InfluxElixir.Config.validate!/1.

InfluxDB v3 API Endpoints

  • Write: POST /api/v2/write?db=DATABASE&precision=PRECISION
  • SQL Query: POST /api/v3/query_sql (JSON body)
  • InfluxQL: POST /api/v3/query_influxql (JSON body)
  • Databases: GET/POST/DELETE /api/v3/configure/database
  • Tokens: POST/DELETE /api/v3/configure/token
  • Health: GET /health

InfluxDB v2 Compatibility

  • Flux: POST /api/v2/query (JSON body)
  • Buckets: GET/POST/DELETE /api/v2/buckets

Request Timeout

Every request uses Finch's :receive_timeout option. The value is resolved with this precedence on each call:

  1. opts[:timeout] (per-call override)
  2. connection[:timeout] (connection-level default)
  3. 30_000 ms (module default, matching InfluxElixir.Flight.Client)

Finch's own default of 15s is bypassed — most production InfluxDB v3 queries need longer. To use the Finch default, pass timeout: 15_000 explicitly. Admin callbacks that don't accept opts (list_databases, delete_database, health, etc.) use the connection-level default or fall back to 30s.