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.
Automatically gzips payloads larger than 1024 bytes by
prepending {:gzip, true} to opts so that the HTTP client can set
the appropriate Content-Encoding: gzip header.
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.
Returns
{:ok, :written}on success{:error, reason}on failure
Examples
iex> {:ok, conn} = InfluxElixir.Client.Local.start()
iex> InfluxElixir.Write.Writer.write(conn, "cpu value=1.0")
{:ok, :written}