From 068ec2eb0a091819a4043de4fe308126093550be Mon Sep 17 00:00:00 2001 From: Wangjunqi123 Date: Tue, 25 Mar 2025 13:47:05 +0800 Subject: [PATCH 1/2] wrap function bytessize_kb; cancel server source vertification --- cmd/agent/webserver/httphandle.go | 39 +-------------------- cmd/server/generator/customTopo.go | 5 +-- cmd/server/generator/generator.go | 15 ++------ cmd/server/global/file.go | 12 ++++++- cmd/server/webserver/handle/basicHandler.go | 4 +-- 5 files changed, 20 insertions(+), 55 deletions(-) diff --git a/cmd/agent/webserver/httphandle.go b/cmd/agent/webserver/httphandle.go index 645e0f5..2cd8c6b 100755 --- a/cmd/agent/webserver/httphandle.go +++ b/cmd/agent/webserver/httphandle.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Fri Nov 8 09:13:05 2024 +0800 @@ -10,7 +10,6 @@ package webserver import ( "fmt" "net/http" - "strings" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/conf" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/global" @@ -22,18 +21,6 @@ import ( ) func RawMetricDataHandle(ctx *gin.Context) { - // 验证topo server请求来源 - if ctx.RemoteIP() != strings.Split(conf.Config().Topo.Server_addr, ":")[0] { - err := errors.Errorf("unknow client request from %s: %s", ctx.RemoteIP(), ctx.Request.URL) - global.ERManager.ErrorTransmit("webserver", "error", err, false, false) - ctx.JSON(http.StatusBadRequest, gin.H{ - "code": -1, - "error": err.Error(), - "data": nil, - }) - return - } - data, err := service.DataCollectorService() if err != nil { err = errors.Wrap(err, " ") @@ -54,18 +41,6 @@ func RawMetricDataHandle(ctx *gin.Context) { } func HealthCheckHandle(ctx *gin.Context) { - // 验证topo server请求来源 - if ctx.RemoteIP() != strings.Split(conf.Config().Topo.Server_addr, ":")[0] { - err := errors.Errorf("unknow client request from %s: %s", ctx.RemoteIP(), ctx.Request.URL) - global.ERManager.ErrorTransmit("webserver", "error", err, false, false) - ctx.JSON(http.StatusBadRequest, gin.H{ - "code": -1, - "error": err.Error(), - "data": nil, - }) - return - } - agentinfo := struct { Interval int `json:"interval"` }{ @@ -76,18 +51,6 @@ func HealthCheckHandle(ctx *gin.Context) { } func ContainerListHandle(ctx *gin.Context) { - // 验证topo server请求来源 - if ctx.RemoteIP() != strings.Split(conf.Config().Topo.Server_addr, ":")[0] { - err := errors.Errorf("unknow client request from %s: %s", ctx.RemoteIP(), ctx.Request.URL) - global.ERManager.ErrorTransmit("webserver", "error", err, false, false) - ctx.JSON(http.StatusBadRequest, gin.H{ - "code": -1, - "error": err.Error(), - "data": nil, - }) - return - } - containers, err := container.ContainerList() if err != nil { err = errors.Wrap(err, "") diff --git a/cmd/server/generator/customTopo.go b/cmd/server/generator/customTopo.go index a1ed797..dfac54e 100644 --- a/cmd/server/generator/customTopo.go +++ b/cmd/server/generator/customTopo.go @@ -298,9 +298,9 @@ func (c *CustomTopo) CreateEdgeEntities(agent *agentmanager.Agent, edges *graph. break } } - // 全局连接remote端,跨网段,本机进程为client端 + // TODO: 全局连接remote端,跨网段,本机进程为client端 - // 全局连接remote端,跨网段,本机进程为server端 + // TODO: 全局连接remote端,跨网段,本机进程为server端 if peernode1 != nil && peernode2 != nil { break @@ -309,6 +309,7 @@ func (c *CustomTopo) CreateEdgeEntities(agent *agentmanager.Agent, edges *graph. if peernode1 != nil && peernode2 != nil && net1 != nil && net2 != nil { var edgetype string + // TODO: type为socket的type, 1 SOCK_STREAM 2 SOCK_DGRAM switch global_net.Type { case 1: edgetype = global.EDGE_TCP diff --git a/cmd/server/generator/generator.go b/cmd/server/generator/generator.go index 30a1940..bd69851 100755 --- a/cmd/server/generator/generator.go +++ b/cmd/server/generator/generator.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Mon Nov 4 14:30:13 2024 +0800 @@ -8,11 +8,8 @@ package generator import ( - "bytes" "context" "encoding/json" - "io" - "os" "sync" "sync/atomic" "time" @@ -149,7 +146,7 @@ func (t *TopoGenerator) collectInstantData() []error { } agentmanager.Global_AgentManager.TAgentMap.Range( - func(key, value interface{}) bool { + func(key, value any) bool { wg.Add(1) go func() { @@ -193,13 +190,7 @@ func (t *TopoGenerator) getCollectDataFromTopoAgent(agent *agentmanager.Agent) e return errors.Errorf("%s, %s", url, err.Error()) } - // ttcode - tmpfile, _ := os.CreateTemp("", "response") - defer os.Remove(tmpfile.Name()) - reader := bytes.NewReader(resp.Body) - io.Copy(tmpfile, reader) - fileInfo, _ := tmpfile.Stat() - global.ERManager.ErrorTransmit("generator", "info", errors.Errorf("采集数据大小: %s, %d kb\n", agent.UUID, fileInfo.Size()/1024), false, false) + global.ERManager.ErrorTransmit("generator", "info", errors.Errorf("采集数据大小: %s, %d kb\n", agent.UUID, global.BytesSize_kb(resp.Body)), false, false) if statuscode := resp.StatusCode; statuscode != 200 { return errors.Errorf("%v, %s", resp.StatusCode, url) diff --git a/cmd/server/global/file.go b/cmd/server/global/file.go index 6ad1c99..acc7398 100755 --- a/cmd/server/global/file.go +++ b/cmd/server/global/file.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Mon Nov 4 14:30:13 2024 +0800 @@ -8,6 +8,7 @@ package global import ( + "bytes" "io" "os" @@ -48,3 +49,12 @@ func FileReadBytes(filePath string) ([]byte, error) { return content, nil } + +func BytesSize_kb(_bytes []byte) int64 { + tmpfile, _ := os.CreateTemp("", "response") + defer os.Remove(tmpfile.Name()) + reader := bytes.NewReader(_bytes) + io.Copy(tmpfile, reader) + fileInfo, _ := tmpfile.Stat() + return fileInfo.Size() / 1024 +} diff --git a/cmd/server/webserver/handle/basicHandler.go b/cmd/server/webserver/handle/basicHandler.go index b879dfa..177ce68 100644 --- a/cmd/server/webserver/handle/basicHandler.go +++ b/cmd/server/webserver/handle/basicHandler.go @@ -29,13 +29,13 @@ func HeartbeatHandle(ctx *gin.Context) { value := redismanager.AgentHeartbeat{} if err := ctx.ShouldBindJSON(&value); err != nil { - err := errors.Errorf("bind json failed: %s", err.Error()) + err := errors.Errorf("bind json failed(%s): %s", ctx.Request.RemoteAddr, err.Error()) ctx.JSON(http.StatusInternalServerError, gin.H{ "code": -1, "error": err.Error(), "data": nil, }) - global.ERManager.ErrorTransmit("webserver", "error", err, true, true) + global.ERManager.ErrorTransmit("webserver", "error", err, false, true) } ctx.Request.Body.Close() -- Gitee From 687fa41dca389d57de0761130c8287ff666f6cd3 Mon Sep 17 00:00:00 2001 From: Wangjunqi123 Date: Tue, 29 Apr 2025 11:01:37 +0800 Subject: [PATCH 2/2] end --- cmd/agent/main.go | 10 +-- cmd/server/generator/generator.go | 2 +- cmd/server/pluginclient/pluginClient.go | 74 +++++++++++++++---- .../service/webclient/webclientmanage.go | 66 ++++++++++------- .../webserver/handle/customTopoHandler.go | 8 +- web/src/request/prometheus.ts | 6 +- web/vite.config.ts | 2 +- 7 files changed, 113 insertions(+), 55 deletions(-) diff --git a/cmd/agent/main.go b/cmd/agent/main.go index f108cb1..6a80dc7 100755 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Mon Nov 4 14:30:13 2024 +0800 @@ -13,11 +13,10 @@ import ( "runtime" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/conf" + "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/global" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/resourcemanage" - "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/service" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/signal" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/webserver" - "gitee.com/openeuler/PilotGo-plugin-topology/cmd/agent/global" "gitee.com/openeuler/PilotGo/sdk/logger" ) @@ -38,7 +37,8 @@ func main() { webserver.InitWebServer() - service.SendHeartbeat() + // ttcode + // service.SendHeartbeat() signal.SignalMonitoring() -} \ No newline at end of file +} diff --git a/cmd/server/generator/generator.go b/cmd/server/generator/generator.go index bd69851..03309ac 100755 --- a/cmd/server/generator/generator.go +++ b/cmd/server/generator/generator.go @@ -100,7 +100,7 @@ func (t *TopoGenerator) ProcessingData(agentnum int) (*graph.Nodes, *graph.Edges go func(ctx context.Context, _agent *agentmanager.Agent, _nodes *graph.Nodes, _edges *graph.Edges) { defer wg.Done() - if _agent.Host_2 != nil && _agent.Processes_2 != nil && _agent.Netconnections_2 != nil { + if _agent.Host_2 != nil && _agent.Processes_2 != nil { err := t.Factory.CreateNodeEntities(_agent, _nodes) if err != nil { process_errorlist_rwlock.Lock() diff --git a/cmd/server/pluginclient/pluginClient.go b/cmd/server/pluginclient/pluginClient.go index fcc628d..14676a9 100644 --- a/cmd/server/pluginclient/pluginClient.go +++ b/cmd/server/pluginclient/pluginClient.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Mon Nov 4 14:30:13 2024 +0800 @@ -10,6 +10,7 @@ package pluginclient import ( "fmt" "os" + "sync" "time" "gitee.com/openeuler/PilotGo-plugin-topology/cmd/server/conf" @@ -32,9 +33,11 @@ func InitPluginClient() { Global_Client = client.DefaultClient(PluginInfo) - GetExtentions() + getExtentions() - GetTags() + getTags() + + getPermissions() go uploadResource() } @@ -68,7 +71,7 @@ func uploadResource() { } // 注册插件扩展点 -func GetExtentions() { +func getExtentions() { var ex []common.Extention pe1 := &common.PageExtention{ Type: common.ExtentionPage, @@ -84,19 +87,19 @@ func GetExtentions() { } me1 := &common.MachineExtention{ Type: common.ExtentionMachine, - Name: "部署topo-collect", + Name: "安装拓扑agent", URL: "/plugin/topology/api/deploy_collect_endpoint", Permission: "plugin.topology.agent/install", } me2 := &common.MachineExtention{ Type: common.ExtentionMachine, - Name: "停用topo-collect", + Name: "停用拓扑agent", URL: "/plugin/topology/api/collect_endpoint?action=stop", Permission: "plugin.topology.agent/stop", } me3 := &common.MachineExtention{ Type: common.ExtentionMachine, - Name: "卸载topo-collect", + Name: "卸载拓扑agent", URL: "/plugin/topology/api/collect_endpoint?action=remove", Permission: "plugin.topology.agent/remove", } @@ -104,18 +107,59 @@ func GetExtentions() { Global_Client.RegisterExtention(ex) } -func GetTags() { +func getTags() { tag_cb := func(uuids []string) []common.Tag { + machines, err := Global_Client.MachineList() + if err != nil { + return nil + } + + var mu sync.Mutex + var wg sync.WaitGroup var tags []common.Tag - for _, uuid := range uuids { - tag := common.Tag{ - UUID: uuid, - Type: common.TypeOk, - Data: "topo-collect", - } - tags = append(tags, tag) + for _, m := range machines { + wg.Add(1) + go func(_m *common.MachineNode) { + if global.IsIPandPORTValid(_m.IP, "9992") { + tag := common.Tag{ + UUID: _m.UUID, + Type: common.TypeOk, + Data: "拓扑", + } + mu.Lock() + tags = append(tags, tag) + mu.Unlock() + } else { + tag := common.Tag{ + UUID: _m.UUID, + Type: common.TypeError, + Data: "", + } + mu.Lock() + tags = append(tags, tag) + mu.Unlock() + } + wg.Done() + }(m) } + wg.Wait() return tags } Global_Client.OnGetTags(tag_cb) } + +func getPermissions() { + var pe []common.Permission + p1 := common.Permission{ + Resource: "topology", + Operate: "menu", + } + + p2 := common.Permission{ + Resource: "topology_operate", + Operate: "button", + } + + p := append(pe, p1, p2) + Global_Client.RegisterPermission(p) +} diff --git a/cmd/server/service/webclient/webclientmanage.go b/cmd/server/service/webclient/webclientmanage.go index 8238bcf..e6c91c8 100644 --- a/cmd/server/service/webclient/webclientmanage.go +++ b/cmd/server/service/webclient/webclientmanage.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Wed Nov 6 09:16:53 2024 +0800 @@ -10,6 +10,7 @@ package webclient import ( "fmt" "strconv" + "strings" "sync" "time" @@ -21,25 +22,25 @@ import ( var WebClientsManager *WebClientsManagement +type WebClientsManagement struct { + webClients map[string][]*graph.TopoDataBuffer +} + func InitWebClientsManager() { WebClientsManager = &WebClientsManagement{ - webClients: make(map[string]*graph.TopoDataBuffer), + webClients: make(map[string][]*graph.TopoDataBuffer), } // go WebClientsManager.HeartbeatDetect() } -type WebClientsManagement struct { - webClients map[string]*graph.TopoDataBuffer -} - // 更新前端client图数据缓存 func (wcm *WebClientsManagement) UpdateClientTopoDataBuffer(_id string, _custom_topodata *graph.TopoDataBuffer) { - if wcm.Get(_id) == nil || wcm.Get(_id).TopoConfId != _custom_topodata.TopoConfId { + if wcm.Get(_id, _custom_topodata.TopoConfId) == nil { wcm.Add(_id, _custom_topodata) } else { var wg sync.WaitGroup - for uuid, global_node_slice := range wcm.Get(_id).Nodes.LookupByUUID { + for uuid, global_node_slice := range wcm.Get(_id, _custom_topodata.TopoConfId).Nodes.LookupByUUID { wg.Add(1) go func(_uuid string, _global_node_slice []*graph.Node) { defer wg.Done() @@ -76,12 +77,12 @@ func (wcm *WebClientsManagement) UpdateClientTopoDataBuffer(_id string, _custom_ } custom_edge := custom_edge_any.(*graph.Edge) - global_edge_id_slice, ok := wcm.Get(_id).Edges.Node_Edges_map.Load(global_node.ID) + global_edge_id_slice, ok := wcm.Get(_id, _custom_topodata.TopoConfId).Edges.Node_Edges_map.Load(global_node.ID) if !ok { continue } for _, global_edge_id := range global_edge_id_slice.([]string) { - global_edge_any, ok := wcm.Get(_id).Edges.Lookup.Load(global_edge_id) + global_edge_any, ok := wcm.Get(_id, _custom_topodata.TopoConfId).Edges.Lookup.Load(global_edge_id) if !ok { continue } @@ -110,7 +111,7 @@ func (wcm *WebClientsManagement) UpdateClientTopoDataBuffer(_id string, _custom_ // 将新图数据中的新增节点及边添加到缓存图数据中 for _, custom_node := range _custom_topodata.Nodes.LookupByUUID[_uuid] { if !custom_node_matched_state_map[custom_node.ID] { - wcm.Get(_id).Nodes.Add(custom_node) + wcm.Get(_id, _custom_topodata.TopoConfId).Nodes.Add(custom_node) custom_edge_id_slice_any, ok := _custom_topodata.Edges.Node_Edges_map.Load(custom_node.ID) if !ok { continue @@ -121,30 +122,30 @@ func (wcm *WebClientsManagement) UpdateClientTopoDataBuffer(_id string, _custom_ continue } custom_edge := custom_edge_any.(*graph.Edge) - wcm.Get(_id).Edges.Add(custom_edge) + wcm.Get(_id, _custom_topodata.TopoConfId).Edges.Add(custom_edge) } } } // 删减缓存图数据中过期的节点及边 for _, global_node := range _global_node_slice { if !global_node_matched_state_map[global_node.ID] { - err := wcm.Get(_id).Nodes.Remove(global_node) + err := wcm.Get(_id, _custom_topodata.TopoConfId).Nodes.Remove(global_node) if err != nil { err = errors.Wrap(err, "->") global.ERManager.ErrorTransmit("webclient", "error", err, false, true) continue } - global_edge_id_slice_any, ok := wcm.Get(_id).Edges.Node_Edges_map.Load(global_node.ID) + global_edge_id_slice_any, ok := wcm.Get(_id, _custom_topodata.TopoConfId).Edges.Node_Edges_map.Load(global_node.ID) if !ok { continue } for _, global_edge_id := range global_edge_id_slice_any.([]string) { - global_edge_any, ok := wcm.Get(_id).Edges.Lookup.Load(global_edge_id) + global_edge_any, ok := wcm.Get(_id, _custom_topodata.TopoConfId).Edges.Lookup.Load(global_edge_id) if !ok { continue } global_edge := global_edge_any.(*graph.Edge) - err := wcm.Get(_id).Edges.Remove(global_edge.ID) + err := wcm.Get(_id, _custom_topodata.TopoConfId).Edges.Remove(global_edge.ID) if err != nil { err = errors.Wrap(err, "->") global.ERManager.ErrorTransmit("webclient", "error", err, false, true) @@ -196,25 +197,33 @@ func (wcm *WebClientsManagement) isSamePstreeBranch(old_node, new_node *graph.No } func (wcm *WebClientsManagement) Add(_id string, _topodata *graph.TopoDataBuffer) { - wcm.webClients[_id] = _topodata + wcm.webClients[_id] = append(wcm.webClients[_id], _topodata) } func (wcm *WebClientsManagement) Delete(_id string) { delete(wcm.webClients, _id) } -func (wcm *WebClientsManagement) Get(_id string) *graph.TopoDataBuffer { - value, ok := wcm.webClients[_id] +func (wcm *WebClientsManagement) Get(_id, _conf_id string) *graph.TopoDataBuffer { + all_buffer, ok := wcm.webClients[_id] if !ok { return nil } - return value + for _, value := range all_buffer { + if value.TopoConfId == _conf_id { + return value + } + } + return nil } -func (wcm *WebClientsManagement) ReturnWebClients() map[string]graph.TopoDataBuffer { - temp_webclients := make(map[string]graph.TopoDataBuffer) - for k, v := range wcm.webClients { - temp_webclients[k] = *v +func (wcm *WebClientsManagement) ReturnWebClients() map[string][]graph.TopoDataBuffer { + temp_webclients := make(map[string][]graph.TopoDataBuffer) + for k, vs := range wcm.webClients { + for _, v := range vs { + temp_webclients[k] = append(temp_webclients[k], *v) + } + } return temp_webclients } @@ -228,8 +237,13 @@ func (wcm *WebClientsManagement) HeartbeatDetect() { case <-global.ERManager.GoCancelCtx.Done(): return case <-time.After(1 * time.Second): - for k, v := range wcm.webClients { - fmt.Printf(">>>clientId: %s, topoConfId: %s\n", k, v.TopoConfId) + for k, vs := range wcm.webClients { + confid_arr := []string{} + for _, v := range vs { + confid_arr = append(confid_arr, v.TopoConfId) + } + confid := strings.Join(confid_arr, ", ") + fmt.Printf(">>>clientId: %s, topoConfId: %s\n", k, confid) } } } diff --git a/cmd/server/webserver/handle/customTopoHandler.go b/cmd/server/webserver/handle/customTopoHandler.go index b20ed87..8ba6c89 100755 --- a/cmd/server/webserver/handle/customTopoHandler.go +++ b/cmd/server/webserver/handle/customTopoHandler.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-topology licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: Wangjunqi123 * Date: Thu Nov 7 15:34:16 2024 +0800 @@ -172,8 +172,8 @@ func RunCustomTopoHandle(ctx *gin.Context) { response.Fail(ctx, nil, errors.Cause(err).Error()) return } - if len(custom_topodata.Nodes.Nodes) == 0 || len(custom_topodata.Edges.Edges) == 0 { - err := errors.New("nodes list is null or edges list is null") + if len(custom_topodata.Nodes.Nodes) == 0 { + err := errors.New("nodes is null") global.ERManager.ErrorTransmit("webserver", "error", err, false, true) doneChan <- custom_topodata response.Fail(ctx, nil, errors.Cause(err).Error()) @@ -182,7 +182,7 @@ func RunCustomTopoHandle(ctx *gin.Context) { webclient.WebClientsManager.UpdateClientTopoDataBuffer(webclient_id, custom_topodata) - doneChan <- webclient.WebClientsManager.Get(webclient_id) + doneChan <- webclient.WebClientsManager.Get(webclient_id, custom_topodata.TopoConfId) }() select { diff --git a/web/src/request/prometheus.ts b/web/src/request/prometheus.ts index 9b22937..0bc03e9 100644 --- a/web/src/request/prometheus.ts +++ b/web/src/request/prometheus.ts @@ -9,7 +9,7 @@ import request from './request' // 获取指标列表 export function getPromRules() { return request({ - url: '/plugin/prometheus/api/v1/targets', + url: '/plugin/prometheus/api/targets', method: 'get', }) } @@ -17,7 +17,7 @@ export function getPromRules() { // 获取prome某一时间点的数据 export function getPromeCurrent(data: object) { return request({ - url: '/plugin/prometheus/api/v1/query', + url: '/plugin/prometheus/api/query', method: 'get', params: data }) @@ -26,7 +26,7 @@ export function getPromeCurrent(data: object) { // 获取prome某一时间段的数据 export function getPromeRange(data: object) { return request({ - url: '/plugin/prometheus/api/v1/query_range', + url: '/plugin/prometheus/api/query_range', method: 'get', params: data }) diff --git a/web/vite.config.ts b/web/vite.config.ts index 0525639..c98771a 100755 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -28,7 +28,7 @@ export default defineConfig({ server:{ proxy:{ "/plugin/topology/api": { - target: 'http://127.0.0.1:9991', + target: 'http://10.41.161.101:9991', // target: 'http://10.44.55.72:9991', changeOrigin:true, secure: false, -- Gitee