Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
917 views
in Technique[技术] by (71.8m points)

prometheus - How to combine multiple datasources in Grafana

We have multiple deployments (e.g. QA and Prod). Before we introduced Loki each of our Grafana Dashboard had a datasource variable where you could select if you want to see the Metrics from the QA or Prod Prometheus.

Now, since we introduced Loki and we want to have panels showing Prometheus metrics and Loki logs from the same environment. Now with Loki in place, I need two varibles, one to selectt the Prometheus instance and one for the Loki instance.

The issues are now,

  • that I need to select the environment twice
  • I could select the Promethes and Loki from different Environments (e.g. Prometheus QA and Loki Prod)

I tried to make the Loki instance dependent on the Prometheus instance (or the other way around), tried to extract the Deployment Postfix from the name of the previously selected datasource to select the other.

The only way I found was to hardcode the environments in a "custom" variable with the values "QA" and "Prod" and them make the Prometheus datasoure selection dependent on that selection see here and here. Since only a single Prometheus and Loki instance is left, I hid the varible completely to reduce confusion.

Is that the way to go or is there another dynamic way to go?

question from:https://stackoverflow.com/questions/65849362/how-to-combine-multiple-datasources-in-grafana

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes I would say that is the way to go. As far as is documented, there's not a way to associate datasources in the desired way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...