Skip to content

Commit

Permalink
cherry pick #3622 to release-1.1 (#3626)
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <[email protected]>

Co-authored-by: Mike <[email protected]>
  • Loading branch information
ti-srebot and mikechengwei authored Dec 18, 2020
1 parent d41febf commit 0f343c1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions pkg/monitor/monitor/monitor_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (m *MonitorManager) SyncMonitor(monitor *v1alpha1.TidbMonitor) error {
if monitor.DeletionTimestamp != nil {
return nil
}
if monitor.Spec.Clusters == nil || len(monitor.Spec.Clusters) != 1 {
klog.Errorf("tm[%s/%s] does not configure the target tidbcluster or contain multiple target tidbclusters, ingore sync", monitor.Namespace, monitor.Name)
if monitor.Spec.Clusters == nil || len(monitor.Spec.Clusters) < 1 {
klog.Errorf("tm[%s/%s] does not configure the target tidbcluster", monitor.Namespace, monitor.Name)
return nil
}
defaultTidbMonitor(monitor)
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitor/monitor/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func scrapeJob(jobName string, componentPattern config.Regexp, cmodel *MonitorCo
}

scrapeconfig := &config.ScrapeConfig{
JobName: jobName,
JobName: fmt.Sprintf("%s-%s-%s", cluster.Namespace, cluster.Name, jobName),
ScrapeInterval: model.Duration(15 * time.Second),
Scheme: "http",
HonorLabels: true,
Expand Down
40 changes: 20 additions & 20 deletions pkg/monitor/monitor/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ alerting:
rule_files:
- /prometheus-rules/rules/*.rules.yml
scrape_configs:
- job_name: pd
- job_name: ns1-target-pd
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -80,7 +80,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tidb
- job_name: ns1-target-tidb
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -127,7 +127,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tikv
- job_name: ns1-target-tikv
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -174,7 +174,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tiflash
- job_name: ns1-target-tiflash
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -221,7 +221,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tiflash-proxy
- job_name: ns1-target-tiflash-proxy
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -268,7 +268,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: pump
- job_name: ns1-target-pump
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -315,7 +315,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: drainer
- job_name: ns1-target-drainer
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -362,7 +362,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: ticdc
- job_name: ns1-target-ticdc
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -409,7 +409,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: importer
- job_name: ns1-target-importer
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -456,7 +456,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: lightning
- job_name: ns1-target-lightning
honor_labels: true
scrape_interval: 15s
scheme: http
Expand Down Expand Up @@ -524,7 +524,7 @@ func TestRenderPrometheusConfigTLSEnabled(t *testing.T) {
rule_files:
- /prometheus-rules/rules/*.rules.yml
scrape_configs:
- job_name: pd
- job_name: ns1-target-pd
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -574,7 +574,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tidb
- job_name: ns1-target-tidb
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -624,7 +624,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tikv
- job_name: ns1-target-tikv
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -674,7 +674,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tiflash
- job_name: ns1-target-tiflash
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -724,7 +724,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: tiflash-proxy
- job_name: ns1-target-tiflash-proxy
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -774,7 +774,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: pump
- job_name: ns1-target-pump
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -824,7 +824,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: drainer
- job_name: ns1-target-drainer
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -874,7 +874,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: ticdc
- job_name: ns1-target-ticdc
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -924,7 +924,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: importer
- job_name: ns1-target-importer
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down Expand Up @@ -974,7 +974,7 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_component]
target_label: component
action: replace
- job_name: lightning
- job_name: ns1-target-lightning
honor_labels: true
scrape_interval: 15s
scheme: https
Expand Down

0 comments on commit 0f343c1

Please sign in to comment.