16

I am looking through all the InfluxDB examples, and they all seem to insert with "time now" (time of insert). There is a well-defined "time" field, but none of the examples use it.

Recording the time of an event as "insert time into the DB" is a poor pattern. It's always better to have the sensor attach to the sensor value its idea of the current time, pass that record around, and insert into various analytics DBs with that time value. ( really small sensors might have a "controller" that knows time better, but that's still not the database insert ).

An obvious example is log files. Each line has a timestamp, right at the beginning. Love it or hate it, but that's your best view of the time the event happened.

I'm looking for examples of inserting into InfluxDB with a specified time value, and haven't come up with one yet. Time appears to always be the implied current time.

4

3 に答える 3

3

はい、完全に可能です。値フィールドと一緒に「時間」列を指定するだけです。例えば:

{
  name:    "my_serie",
  columns: ["time", "value1", "value2"],
  points:  [
             [1429807111, 1, 2],
             [1429807111, 11, 22],
             [1429807111, 111, 222]
           ]
}

もちろん、必要な数の列を指定できます。

于 2015-04-23T16:40:46.223 に答える