Here there are 2 visualizations. on the top there is a state timeline that continuously shows a state and on the bottom a graph with float values. I want to combine these 2 visualizations in 1 state timeline. when there are no values in the bottom graph, nothing is shown.
query for state timeline:
data = from(bucket: "v1-logs")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "ui_states")
|> keep(columns: ["_time", "_value"])
|> rename(columns: {_value: "UI STATE"})
|> yield()
query for bottom graph (system resources)
data = from(bucket: "otiv.one-v1-logs")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r.client == "${client}" and r.site == "${site}" and r.loc == "${loc}" and r.unit == "${unit}")
|> filter(fn: (r) => r._measurement == "system_resources")
|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
|> keep(columns: ["_time", "cpu_usage", "ram_usage"])
|> yield()
my current problems:
- The system gets shut off and on during the day. when it is shut off it has to show no data. My problem is that in the state timeline it will always show the last state.
- cannot directly combine the data because the timestamps are slightly different and I cannot aggregateWindow on the states because there are string values
- how to fill the system resource data with a boolean when there is data or not (fill in the gaps with false every 1s orso)