Skip to content

Commit

Permalink
fix tiflash
Browse files Browse the repository at this point in the history
  • Loading branch information
Song Gao committed Jun 19, 2020
1 parent fb93c13 commit 1e55a5a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion pkg/monitor/monitor/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,17 @@ func buildAddressRelabelConfigByComponent(kind string) *config.RelabelConfig {
case "tiflash":
return f()
case "tiflash-proxy":
return f()
return &config.RelabelConfig{
Action: config.RelabelReplace,
Regex: addressPattern,
Replacement: "$1.$2-tiflash-peer:$3",
TargetLabel: "__address__",
SourceLabels: model.LabelNames{
podNameLabel,
instanceLabel,
model.LabelName(fmt.Sprintf(additionalPortLabelPattern, "tiflash_proxy")),
},
}
case "pump":
return &config.RelabelConfig{
Action: config.RelabelReplace,
Expand Down
8 changes: 4 additions & 4 deletions pkg/monitor/monitor/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ scrape_configs:
target_label: __metrics_path__
action: replace
- source_labels: [__meta_kubernetes_pod_name, __meta_kubernetes_pod_label_app_kubernetes_io_instance,
__meta_kubernetes_pod_annotation_prometheus_io_port]
__meta_kubernetes_pod_annotation_tiflash_proxy_prometheus_io_port]
regex: (.+);(.+);(.+)
target_label: __address__
replacement: $1.$2-tiflash-proxy-peer:$3
replacement: $1.$2-tiflash-peer:$3
action: replace
- source_labels: [__meta_kubernetes_namespace]
target_label: kubernetes_namespace
Expand Down Expand Up @@ -622,10 +622,10 @@ scrape_configs:
target_label: __metrics_path__
action: replace
- source_labels: [__meta_kubernetes_pod_name, __meta_kubernetes_pod_label_app_kubernetes_io_instance,
__meta_kubernetes_pod_annotation_prometheus_io_port]
__meta_kubernetes_pod_annotation_tiflash_proxy_prometheus_io_port]
regex: (.+);(.+);(.+)
target_label: __address__
replacement: $1.$2-tiflash-proxy-peer:$3
replacement: $1.$2-tiflash-peer:$3
action: replace
- source_labels: [__meta_kubernetes_namespace]
target_label: kubernetes_namespace
Expand Down

0 comments on commit 1e55a5a

Please sign in to comment.