Skip to content

Conversation

@SunnyBoy-WYH
Copy link
Contributor

What type of PR is this?
batch query in single request for one panel
What this PR does / why we need it:
the browser limit request num,so when many panel loading metric data, some web request will be block.
Which issue(s) this PR fixes:

no issue fix, but this may be faster,and grafana has implement this.

for code:

  1. extract common api define ,remove from server's reader dir.
  2. add one gin router for batch query.
  3. use prom client to request data.

Kindly give me your advice,Thanks!

@@ -0,0 +1,76 @@
package common
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to change the package name to prom

return c, has
}

func (cs *ClustersType) GetClusters() []*ClusterType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法是不是已经不需要了?

opts := config.C.Clusters

for i := 0; i < len(opts); i++ {
transport := &http.Transport{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initClustersFromConfig 和 initClustersFromAPI 中有大片代码重复,看看是否可以抽取出方法?

if err = prom.Init(); err != nil {
return nil, err
}
// init reader clients
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重复了,上面已经有了prom.Init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants