
as we will use distinct Influx and Grafana instances for the different stages/environments.
15 lines
686 B
Plaintext
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: ""})
|