Skip to content

Commit

Permalink
docs: add metric timeunit example to README (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeTupchiy authored Jan 26, 2024
1 parent 519b7c2 commit 6ceb182
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ Write data by rows:
greptimedb:write(Client, Metric, Points).
```

Write data specifying `timeunit`:

```erlang
Metric = #{table => <<"temperatures_nanosec">>,
timeunit => nanosecond},
Points =
[#{fields => #{<<"temperature">> => 1},
tags =>
#{<<"from">> => <<"mqttx_4b963a8e">>,
<<"host">> => <<"serverA">>,
<<"qos">> => greptimedb_values:int64_value(0),
<<"region">> => <<"hangzhou">>},
timestamp => 1705946037724448346}],

{ok, #{response := {affected_rows, #{value := 1}}}} =
greptimedb:write(Client, Metric, Points).
```

Write in async:

```erlang
Expand Down Expand Up @@ -172,4 +190,4 @@ Finish benchmark,
cost: 48 seconds,
rows: 10000000,
TPS: 208333.33333333334
```
```

0 comments on commit 6ceb182

Please sign in to comment.