cortex-tools
cortex-tools copied to clipboard
Improve behaviour when using cortextool interacting with a Loki / GEL cluster
Currently, if trying to use the standard cortextool commands to interact with a Loki or GEL cluster e.g.
-
cortextool rules print
-
cortextool rules load
These commands will fail as the interaction is different, /loki
needs appending to the server address and additionally, for loading rules, cortextool will complain that the |
character is not valid as it is trying to parse them as PromQL rules, not LogQL rules.
Adding the --backend=loki
flag gets around this issue and I have filed 1 PR (#228) and 1 issue (#229) to improve documentation of this flag.
But could we make this a more automated experience?
I would imagine it's possible to detect whether we are interacting with a Cortex or Loki (or GEM or GEL) cluster, so could we use that information to something like one of the following?
- Inform the user when it is a Loki cluster e.g. "It looks like you are trying to address a Loki cluster, please add the flag
--backend=loki
to all commands for them to succeed" - Do it automatically for the user e.g. just silently add the flag to the commands so that they succeed, or print a notice while doing it.
Also, the version of cortextool in the container image grafana/cortextool:latest
doesn't appear to be aware of the --backend=loki
flag. It does, however seem the image grafana/cortex-tools:latest
version of cortextool is aware of this flag