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

Add grafana configuration support #108

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading