02_data-ingestion
02_data-ingestion
2
Data Lifecycle
6
Let’s start by example
• Weather conditions
• Stock exchange
• Healthcare
• Cluster monitoring
• Logs
• Traces
VS.
VS.
VS.
VS.
VS.
metrics
© 2021 InfluxData. All rights reserved. 13
What’s the difference?
both of them are time series, but …
We monitor the The phenomena happen
phenomena and we observe them
regular irregular
VS.
metrics events
Measurements
gathered at regular
time intervals
Measurements Measurements
gathered at regular observed at irregular
time intervals time intervals
21
Conceptual vs. logical vs. physical views
[Src: https://www.oreilly.com/library/view/data-modeling-made/9781935504481/ ]
© 2021 InfluxData. All rights reserved. 22
How is data ingested?
Conceptual View
23
Let’s start from the anatomy of a Time-Series Line Graph
35
Data Model
• Measurement
– A name to group data at high level
• Tag set
– A set of key-value pairs to group data at low level (values are strings)
• Field set
– A set of key-value pairs to represent data (values are numerical & strings)
• Timestamp
– Time of the data with nanosecond precision
• Series
– A unique combination of measurement+tags
© 2021 InfluxData. All rights reserved. 36
Data model vs ingestion & storage
Measurement
Tag set
Field set
Timestamp
Measurement
Tag set
Field set
Timestamp
Buckets
Measurement (set of series)
Tag set
Field set
Timestamp
41
An example of Line Protocol
Measurement
Tags
whitespace
Tags
Fields
whitespace
Fields
timestamp
Reference: https://v2.docs.influxdata.com/v2.0/reference/line-protocol/
… … … … … … …
_m = _measurement
tags fields
© 2021 InfluxData. All rights reserved. 48
So, the line protocol representations of two metrics are …
54
Telegraf
1
© 2021 InfluxData. All rights reserved. 64
Use Case: Continuous Linear Pizza Oven
Sensors observe
• temperature (C°)
• relative humidity (%)
of the two ovens
Learning Goals
• Line protocol
usage
• First query
iot-oven,sensor=S1 temperature=290,humidity=30
1636372800000000000
iot-oven,sensor=S2 temperature=105,humidity=55
1636372815000000000
iot-oven,sensor=S1 temperature=305,humidity=38
1636372860000000000
iot-oven,sensor=S2 temperature=120,humidity=65
1636372875000000000
…
© 2021 InfluxData. All rights reserved. 67
Let’s do some live coding
from(bucket: "training")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "iot-oven")
|> filter(fn: (r) => r._field == "temperature")
|> filter(fn: (r) => r.sensor == "S2")
|> filter(fn: (r) => r._value > 100)