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

PMM-3303 Monitor internal clickhouse #2943

Merged
merged 9 commits into from
May 7, 2024
3 changes: 2 additions & 1 deletion managed/services/victoriametrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ func AddInternalServicesToScrape(cfg *config.Config, s models.MetricsResolutions
scrapeConfigForAlertmanager(s.MR),
scrapeConfigForGrafana(s.MR),
scrapeConfigForPMMManaged(s.MR),
scrapeConfigForQANAPI2(s.MR))
scrapeConfigForQANAPI2(s.MR),
scrapeConfigForClickhouse(s.MR))
// TODO Refactor to remove boolean positional parameter when Prometheus is removed
if dbaas {
cfg.ScrapeConfigs = append(cfg.ScrapeConfigs, scrapeConfigForDBaaSController(s.MR))
Expand Down
15 changes: 15 additions & 0 deletions managed/services/victoriametrics/scrape_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ func scrapeConfigForAlertmanager(interval time.Duration) *config.ScrapeConfig {
}
}

func scrapeConfigForClickhouse(mr time.Duration) *config.ScrapeConfig {
return &config.ScrapeConfig{
JobName: "clickhouse",
ScrapeInterval: config.Duration(mr),
ScrapeTimeout: scrapeTimeout(mr),
MetricsPath: "/metrics",
ServiceDiscoveryConfig: config.ServiceDiscoveryConfig{
StaticConfigs: []*config.Group{{
Targets: []string{"127.0.0.1:9363"},
Labels: map[string]string{"instance": "pmm-server"},
}},
},
}
}

func scrapeConfigForGrafana(interval time.Duration) *config.ScrapeConfig {
return &config.ScrapeConfig{
JobName: "grafana",
Expand Down
22 changes: 22 additions & 0 deletions managed/services/victoriametrics/victoriametrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,17 @@ scrape_configs:
labels:
instance: pmm-server
follow_redirects: false
- job_name: clickhouse
honor_timestamps: false
scrape_interval: 10s
scrape_timeout: 9s
metrics_path: /metrics
static_configs:
- targets:
- 127.0.0.1:9363
labels:
instance: pmm-server
follow_redirects: false
- job_name: mongodb_exporter_agent_id_cfec996c-4fe6-41d9-83cb-e1a3b1fe10a8_hr
honor_timestamps: false
scrape_interval: 5s
Expand Down Expand Up @@ -890,6 +901,17 @@ scrape_configs:
labels:
instance: pmm-server
follow_redirects: false
- job_name: clickhouse
honor_timestamps: false
scrape_interval: 10s
scrape_timeout: 9s
metrics_path: /metrics
static_configs:
- targets:
- 127.0.0.1:9363
labels:
instance: pmm-server
follow_redirects: false
`) + "\n"
newcfg, err := svc.marshalConfig(svc.loadBaseConfig())
assert.NoError(t, err)
Expand Down
11 changes: 11 additions & 0 deletions managed/testdata/victoriametrics/promscrape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,14 @@ scrape_configs:
labels:
instance: pmm-server
follow_redirects: false
- job_name: clickhouse
honor_timestamps: false
scrape_interval: 10s
scrape_timeout: 9s
metrics_path: /metrics
static_configs:
- targets:
- 127.0.0.1:9363
labels:
instance: pmm-server
follow_redirects: false
Loading