grafana-tools / sdk

Library for using Grafana' structures in Go programs and client for Grafana REST API.
Apache License 2.0
318 stars 187 forks source link

Target: Alias vs AliasBy; Group vs GroupBy #179

Open kevitan opened 2 years ago

kevitan commented 2 years ago

These 2 groups of fields seem remarkably similar, and I'm not sure which to use. are both needed? It seems that at least for Target.Group vs Target.GroupBy, the former has a little more type safety, but is a little clunkier to use. It seems also that if I declare a Tag to group on, it does not end up in the query, while it does show up in the panel JSON:

{
  "params": [
    "k8s_cluster"
  ],
  "type": "tag"
},

Query: ... GROUP BY time(1s) fill(null)

For Target.Alias vs Target.AliasBy, I don't know if it's working properly, because the legend does not show the series breakdown in the legend. Again, the syntax of these two is different, but the effect seems to be the same in the panel JSON, though it doesn't seem to make a difference in the query. "aliasBy": "$tag_k8s_cluster" in the panel JSON has no effect on the query for the panel.

GiedriusS commented 2 years ago

Unfortunately but Grafana doesn't have a strict schema for dashboards so the answer probably depends on which version you are using. We've had plans to separate fields according to major Grafana versions but it never came to fruition.