Time Series

  • Bucket
    • Measurement
      • Tags, Fields, Timestamp

Hierarchy

{
    "measurement": "temperature",
    "tags": {
        "location": "office"
    },
    "time": "2023-05-05T12:00:00Z",
    "fields": {
        "value": 22.5
    }
}
  • InfluxQL
  • scale horizontally
  • Grafana
  • open-source (MIT)

Features

Versions

1.0

  • two-level data model
  • InfluxQL
  • third-party
  • LevelDB storage engine

2.0

  • three-level hierarchy data model
  • InfluxQL -> Flux
  • authorization and authentication

Versions

2.0

  • clustering and high availability
  • Time-Structured Merge Tree (TSMC) storage engine

Versions

3.0

  • infinite cardinality
  • object storage separated from compute
  • Apache Parquet (data file format)

Versions

3.0

  • Apache Arrow (columnar memory format)
    • DataFusion (query engine)
  • Go -> Rust
  • Flux, InfluxQL, SQL

Versions

Code

-- querying
SELECT MEAN("value")
FROM "temperature"
WHERE time > now() - 10m

-- downsampling
SELECT MEAN("value")
INTO "temperature_downsampled"
FROM "temperature" GROUP BY time(1h)
-- querying (aggregate)
from(bucket: "get-started")
    |> range(start: 2022-01-01T08:00:00Z, stop: 2022-01-01T20:00:01Z)
    |> filter(fn: (r) => r._measurement == "home")
    |> filter(fn: (r) => r._field == "co" or r._field == "hum" or r._field == "temp")
    |> mean()

-- downsampling
from(bucket: "get-started")
    |> range(start: 2022-01-01T14:00:00Z, stop: 2022-01-01T20:00:01Z)
    |> filter(fn: (r) => r._measurement == "home")
    |> filter(fn: (r) => r._field == "temp")
    |> aggregateWindow(every: 2h, fn: mean)

Code

-- tasks
option task = {
    name: "Example task"
    every: 1d,
}

from(bucket: "get-started-downsampled")
    |> range(start: -task.every)
    |> filter(fn: (r) => r._measurement == "home")
    |> aggregateWindow(every: 2h, fn: mean)

Code

Other

  • Alerts
  • Query Builder
  • Script Editor
  • Telegraf
Made with Slides.com