Skip to content

Instantly share code, notes, and snippets.

@esemeniuc
Last active March 28, 2023 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esemeniuc/3850667b2480920df4bed530522e4cde to your computer and use it in GitHub Desktop.
Save esemeniuc/3850667b2480920df4bed530522e4cde to your computer and use it in GitHub Desktop.
Grafana FluxQL demo
import "array"
 
array.from(rows: [
  {_time: 2021-01-01T00:00:00Z, _value: "foo"},
  {_time: 2020-01-02T00:00:00Z, _value: "bar"}
])

image

import "array"
array.from(rows: [
  {a: display(v: "${host}")}
])
import "array"
import "strings"
array.from(rows: [
  {a: 1, b: display(v:
    strings.split(v: "dallas-testnet-relayer-1_67euUv", t:"_")[0])}
])

  |> filter(fn: (r) => r["host"] == strings.split(v: "${host}", t:"_")[0] or r.host =~ /relayer/)
  |> filter(fn: (r) => contains(value: r.host, set: [${host:json}]))
  |> filter(fn: (r) => r.host =~ /${host:regex}/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment