Files
poseidon/deploy/grafana-dashboard/queries/environment-mapping.flux
Maximilian Paß 1aced0a130 Remove "Stage" variable
as we will use distinct Influx and Grafana instances for the different stages/environments.
2023-01-18 15:33:42 +00:00

15 lines
686 B
Plaintext

envMapping = from(bucket: "poseidon")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "poseidon_environments")
|> filter(fn: (r) => r["event_type"] == "creation")
|> group(columns: ["id", "stage"], mode:"by")
|> last()
|> keep(columns: ["id", "image", "stage"])
|> rename(columns: {id: "environment_id"})
|> map(fn: (r) => ({ r with image: r.environment_id + "/" + strings.trimPrefix(v: r.image, prefix: "openhpi/co_execenv_")}))
join(tables: {key1: result, key2: envMapping}, on: ["environment_id", "stage"], method: "inner")
|> keep(columns: ["_value", "image", "_time"])
|> group(columns: ["image"], mode: "by")
|> rename(columns: {_value: ""})