encode/1 | Encode InfluxDB data point (or list of points) to line. |
encode/2 | Encode measurement and fields (or list of fields) to line. |
encode/3 | Encode measurement, fields (or list of fields) and tags to line. |
encode/4 | Encode measurement, fields (or list of fields), tags and time to line. |
encode_fields/1 | |
encode_tags/1 | |
timestamp/0 | Returns current UTC time in nanoseconds. |
encode(Points::influx_data_points()) -> Line::binary() | {error, Reason::atom()}
Encode InfluxDB data point (or list of points) to line.
Point should contain 'measurement' and 'fields' keys (as atoms).
Other available keys: 'tags', 'time'.
Return binary line(-s) or {error, invalid_data}
if any point contains
neither 'measurement' nor 'fields' key.
Example:
influx_line:encode( #{ measurement => cpu, fields => #{ value => 43}, tags => #{ host => 'eu-west', ip => "127.0.0.1" }, time => 10000000000 } ). <<"cpu,host=eu-west,ip="127.0.0.1" value=43 10000000000\n">>
encode(Name::string() | atom() | binary(), Fields::influx_data_points()) -> Line::binary() | {error, Reason::atom()}
Encode measurement and fields (or list of fields) to line.
encode(Name::string() | atom() | binary(), Fields::influx_data_points(), Tags::influx_data_point() | binary()) -> Line::binary() | {error, Reason::atom()}
Encode measurement, fields (or list of fields) and tags to line.
encode(Name::string() | atom() | binary(), Points::[influx_data_point()] | influx_data_point(), Tags::influx_data_point() | binary(), Time::non_neg_integer() | atom()) -> Line::binary() | {error, Reason::atom()}
Encode measurement, fields (or list of fields), tags and time to line.
If Time is integer then it's used as point time.
If Time is true
then inlux_line:timestamp()
is used as point time.
If there are several points, then every point is set a uniq time
(by incrementing provided time).
Note: if there are several points and no time specified then current time is used as base time.
Example:
%% several points (uniq times) influx_line:encode( cpu, [ #{ value => 43 }, #{ value => 12 } ], #{ host => 'eu-west', ip => "127.0.0.1" }, 1000000000 ). <<"cpu,host=eu-west,ip="127.0.0.1" value=43 1000000000\n cpu,host=eu-west,ip="127.0.0.1" value=12 1000000001\n">> %% one point without time influx_line:encode( cpu, [ #{ value => 43 }, #{ value => 12 } ], #{ host => 'eu-west', ip => "127.0.0.1" } ). <<"cpu,host=eu-west,ip="127.0.0.1" value=43\n">>
encode_fields(Map) -> any()
encode_tags(Tags) -> any()
timestamp() -> Time::non_neg_integer()
Returns current UTC time in nanoseconds
Generated by EDoc