Skip to content

Commit

Permalink
support grafana configuration (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenlj authored Dec 12, 2023
1 parent e39d7bb commit 49cbe64
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conf/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ admin:
address: zookeeper://127.0.0.1:2181
registry:
address: zookeeper://127.0.0.1:2181
grafana:
address: 127.0.0.1:3000
prometheus:
address: 127.0.0.1:9090
monitorPort: 22222
Expand Down
1 change: 1 addition & 0 deletions pkg/admin/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func RegisterDatabase(rt core_runtime.Runtime) error {

func RegisterOther(rt core_runtime.Runtime) error {
config.AdminPort = rt.Config().Admin.AdminPort
config.GrafanaAddress = rt.Config().Admin.Grafana.Address
config.PrometheusAddress = rt.Config().Admin.Prometheus.Address
config.PrometheusMonitorPort = rt.Config().Admin.Prometheus.MonitorPort
address := rt.Config().Admin.ConfigCenter
Expand Down
1 change: 1 addition & 0 deletions pkg/admin/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ var (
PrometheusAddress string
PrometheusMonitorPort string
AdminPort int
GrafanaAddress string
)
2 changes: 2 additions & 0 deletions pkg/admin/model/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type Metadata struct {
ConfigCenter string `json:"configCenter"`
Registry string `json:"registry"`
MetadataCenter string `json:"metadataCenter"`
Grafana string `json:"grafana"`
Prometheus string `json:"prometheus"`
Protocols []interface{} `json:"protocols"`
Rules []string `json:"rules"`
}
2 changes: 2 additions & 0 deletions pkg/admin/services/prometheus_service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ func (p *PrometheusServiceImpl) Metadata() (model.Metadata, error) {
metadata.Registry = config.RegistryCenter.GetURL().Location
metadata.MetadataCenter = config.RegistryCenter.GetURL().Location
metadata.ConfigCenter = config.RegistryCenter.GetURL().Location
metadata.Grafana = config.GrafanaAddress
metadata.Prometheus = config.PrometheusAddress

// rules
rules, err := GetRules("", "*")
Expand Down

0 comments on commit 49cbe64

Please sign in to comment.