Grafana as Code

Transfer our dashboard into a code representation via grafanalib.
This commit is contained in:
Maximilian Paß
2022-10-26 16:51:56 +01:00
parent b98e3deb40
commit 44aa5d73a2
31 changed files with 745 additions and 1746 deletions

View File

@ -0,0 +1,19 @@
import "date"
// The need for the date truncation is caused by Poseidon sending all influx events at the same time when starting up. This way not the last but a random value is displayed.
// Since in this startup process the highest value is the correct one, we choose the highest value of the last events.
data = from(bucket: "poseidon/autogen")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "poseidon_environments")
|> group(columns: ["stage"], mode:"by")
|> map(fn: (r) => ({ r with _time: date.truncate(t: r._time, unit: 1m) }))
deploy_times = data
|> last()
|> keep(columns: ["stage", "_time"])
join(tables: {key1: data, key2: deploy_times}, on: ["stage", "_time"], method: "inner")
|> max()
|> keep(columns: ["stage", "_value"])
|> rename(columns: {_value: ""})