This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 29be198e [horus] Obtain the federal query function (#334)
29be198e is described below

commit 29be198e23f290bc754bab7186951d7b51bc81b9
Author: mfordjody <[email protected]>
AuthorDate: Wed Sep 11 09:49:47 2024 +0800

    [horus] Obtain the federal query function (#334)
---
 app/horus/basic/config/file.go  | 1 +
 app/horus/core/horuser/prome.go | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/horus/basic/config/file.go b/app/horus/basic/config/file.go
index 93b37c2b..d0ae3e6d 100644
--- a/app/horus/basic/config/file.go
+++ b/app/horus/basic/config/file.go
@@ -21,6 +21,7 @@ type Config struct {
        DingTalk       *DingTalkConfiguration `yaml:"dingTalk"`
        Slack          *SlackConfiguration    `yaml:"slack"`
        KubeMultiple   map[string]string      `yaml:"kubeMultiple"`
+       PromMultiple   map[string]string      `yaml:"promMultiple"`
        KubeTimeSecond int64
 }
 
diff --git a/app/horus/core/horuser/prome.go b/app/horus/core/horuser/prome.go
index d83df40d..e50f5761 100644
--- a/app/horus/core/horuser/prome.go
+++ b/app/horus/core/horuser/prome.go
@@ -24,12 +24,17 @@ import (
        "time"
 )
 
-func (h *Horuser) InstantQuery(address, ql string, timeWindowsSecond int64) 
(model.Vector, error) {
+func (h *Horuser) InstantQuery(address, ql, clusterName string, 
timeWindowsSecond int64) (model.Vector, error) {
        client, err := apiV1.NewClient(apiV1.Config{Address: address})
        if err != nil {
                klog.Errorf("prometheus InstantQuery creating NewClient 
error:%v", err)
                return nil, err
        }
+       promClient := h.cc.PromMultiple[clusterName]
+       if promClient == "" && address == "" {
+               klog.Errorf("prometheus get PromMultiple empty")
+               klog.Infof("clusterName:%v ql:%v", clusterName, ql)
+       }
 
        apiV1 := prometheusV1.NewAPI(client)
        ctx, cancel := context.WithTimeout(context.Background(), 
time.Duration(timeWindowsSecond)*time.Second)

Reply via email to