Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query batch feature #1052

Merged
merged 10 commits into from
Jul 17, 2022
Merged

Query batch feature #1052

merged 10 commits into from
Jul 17, 2022

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

@@ -39,6 +42,19 @@ func (cs *ClustersType) Get(name string) (*ClusterType, bool) {
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.

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

@@ -61,17 +77,34 @@ func initClustersFromConfig() error {
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 中有大片代码重复,看看是否可以抽取出方法?

@@ -118,6 +118,10 @@ func (a Webapi) initialize() (func(), error) {
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