InfluxElixir.Write.Writer (InfluxElixir v0.1.14)

Copy Markdown View Source

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.

Summary

Functions

Writes line protocol binary to InfluxDB via the configured client.

Functions

write(connection, line_protocol, opts \\ [])

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 binary
  • opts - keyword options 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}