diff --git a/go.mod b/go.mod index 14bb921aae951cdb2a716d9bfc99e6b6094a1460..5afa294a0c76c9dab6579c09afaf956b66c4515e 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( ) require ( - gitee.com/openeuler/PilotGo/sdk v0.0.0-20250805090901-8510c2ef4ecb + gitee.com/openeuler/PilotGo/sdk v0.0.0-20250806061906-ced6853de86f github.com/bytedance/sonic v1.10.2 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/gin-contrib/sse v0.1.0 // indirect diff --git a/go.sum b/go.sum index 1a5ddc0eea8381856f839a835bcb09e2953520d4..561ec88f85bd8ab6bb613d644798d120123e1354 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ gitee.com/openeuler/PilotGo-plugins/event/sdk v0.0.0-20240730114546-6471a280e4d2 gitee.com/openeuler/PilotGo-plugins/event/sdk v0.0.0-20240730114546-6471a280e4d2/go.mod h1:qKN5mZT240WasFoPqLnmQWJ/PBB5+Db0BiLmCfYaLBk= gitee.com/openeuler/PilotGo/sdk v0.0.0-20250805090901-8510c2ef4ecb h1:QRRgVsmkbBsGexG25Xl32QZ2LGB0ZvHBi+0kjQeK4eI= gitee.com/openeuler/PilotGo/sdk v0.0.0-20250805090901-8510c2ef4ecb/go.mod h1:pIMXKeUO0pOimMAuuo7mtuNJ7/1IpZ8yI77cid+NlZ4= +gitee.com/openeuler/PilotGo/sdk v0.0.0-20250806061906-ced6853de86f h1:nPPSPKI7049Zl28RFcWTxg2ksy/ga7xvzbEh0YrlJqc= +gitee.com/openeuler/PilotGo/sdk v0.0.0-20250806061906-ced6853de86f/go.mod h1:pIMXKeUO0pOimMAuuo7mtuNJ7/1IpZ8yI77cid+NlZ4= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE= diff --git a/server/config.yml.templete b/server/config.yml.templete index e4e3919ee7c33b600c41e7148c05456d0a6165a6..4bd10a529c4171d13088f35c2fdf91a86720473a 100644 --- a/server/config.yml.templete +++ b/server/config.yml.templete @@ -16,3 +16,11 @@ mysql: user: '' password: '' database: PluginPrometheus +etcd: + endpoints: + - "localhost:2379" + service_name: "prometheus-service" + version: "3.0" + dialTimeout: 5s + menu_name: "监控告警" + icon: "Odometer" \ No newline at end of file diff --git a/server/config/config.go b/server/config/config.go index f4c8e6d68fc50f049ef95eb26b41a99d6a3034ba..35144253df18ad82a1a9924e20ab9e2579a3c8b7 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugin-prometheus licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugin-prometheus licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: zhanghan2021 * Date: Wed Jul 26 16:42:38 2023 +0800 @@ -38,10 +38,12 @@ type MysqlDBInfo struct { } type Etcd struct { - Endpoints []string `yaml:"endpoints" mapstructure:"endpoints"` - ServiveName string `yaml:"service_name" mapstructure:"service_name"` - Version string `yaml:"version" mapstructure:"version"` - DialTimeout time.Duration `yaml:"dialTimeout" mapstructure:"dialTimeout"` + Endpoints []string `yaml:"endpoints"` + ServiveName string `yaml:"service_name"` + Version string `yaml:"version"` + DialTimeout time.Duration `yaml:"dialTimeout"` + MenuName string `yaml:"menu_name"` + Icon string `yaml:"icon"` } type ServerConfig struct { diff --git a/server/main.go b/server/main.go index 504d16e7b4e80fcb62517e8d6ab77e73b762aa45..ee6a0d86ee9f7f4c3a5794f27e89416c6302b98e 100644 --- a/server/main.go +++ b/server/main.go @@ -10,7 +10,6 @@ package main import ( "fmt" "os" - "time" "gitee.com/openeuler/PilotGo/sdk/go-micro/registry" "gitee.com/openeuler/PilotGo/sdk/logger" @@ -56,13 +55,13 @@ func main() { service.GetTags() // pilotgo机器列表tag标签 _, err := registry.NewServiceRegistrar(®istry.Options{ - Endpoints: []string{"localhost:2379"}, + Endpoints: config.Config().Etcd.Endpoints, ServiceAddr: config.Config().HttpServer.Addr, - ServiceName: "prometheus-service", - Version: "v3.0", - MenuName: "监控告警", - Icon: "Odometer", - DialTimeout: 5 * time.Second, + ServiceName: config.Config().Etcd.ServiveName, + Version: config.Config().Etcd.Version, + MenuName: config.Config().Etcd.MenuName, + Icon: config.Config().Etcd.Icon, + DialTimeout: config.Config().Etcd.DialTimeout, Extentions: service.GetExtentions(), Permissions: service.GetPermissions(), }) diff --git a/vendor/modules.txt b/vendor/modules.txt index 0f55fc92c3f60d133aa087e5b59d9e0dd374e3f5..7a55fd5e46c21f27c8406eb69b24e2cd8242c294 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,7 +1,7 @@ # gitee.com/openeuler/PilotGo-plugins/event/sdk v0.0.0-20240730114546-6471a280e4d2 ## explicit; go 1.21.6 gitee.com/openeuler/PilotGo-plugins/event/sdk -# gitee.com/openeuler/PilotGo/sdk v0.0.0-20250805090901-8510c2ef4ecb +# gitee.com/openeuler/PilotGo/sdk v0.0.0-20250806061906-ced6853de86f ## explicit; go 1.23.0 gitee.com/openeuler/PilotGo/sdk/common gitee.com/openeuler/PilotGo/sdk/go-micro/registry