Direct single-request write to InfluxDB.
Accepts pre-encoded line protocol binary and forwards it to the configured
client implementation. Automatically applies gzip compression for payloads
larger than 1 KB, and wraps every write in an
[:influx_elixir, :write, ...] telemetry span (see InfluxElixir.Telemetry).
Summary
Functions
Writes line protocol binary to InfluxDB via the configured client.
Functions
@spec write(InfluxElixir.Client.connection(), binary(), keyword()) :: InfluxElixir.Client.write_result()
Writes line protocol binary to InfluxDB via the configured client.
Gzips payloads larger than 1024 bytes, and passes
gzip: true to the client exactly when it has compressed the payload,
so the HTTP client's Content-Encoding: gzip header always matches the
body.
Parameters
connection- connection term (opaque, passed to client)line_protocol- encoded line protocol binaryopts- keyword options forwarded to the client, plus::client- client module to use instead of the configured one (InfluxElixir.Client.impl/0). Not forwarded to the client.:gzip-truecompresses the payload whatever its size,falsenever does; by default only payloads over 1024 bytes are. An explicittrueused to reach the client with the payload uncompressed, and the server refused the header (error decoding gzip stream, verified).
Returns
{:ok, :written}on success{:error, reason}on failure
Examples
iex> {:ok, conn} = InfluxElixir.Client.Local.start(database: "mydb")
iex> InfluxElixir.Write.Writer.write(conn, "cpu value=1.0")
{:ok, :written}