Skip to content

Commit

Permalink
metrics: fix metrics Get Backend Count and Ping Backend Duration (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
djshow832 authored May 16, 2023
1 parent ea6ae2e commit 8bbb0e9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pkg/manager/router/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@ func readMigrateCounter(from, to string, succeed bool) (int, error) {

func setPingBackendMetrics(addr string, succeed bool, startTime time.Time) {
cost := time.Since(startTime)
resLabel := succeedToLabel(succeed)
metrics.PingBackendGauge.WithLabelValues(addr, resLabel).Set(cost.Seconds())
metrics.PingBackendGauge.WithLabelValues(addr).Set(cost.Seconds())
}
2 changes: 1 addition & 1 deletion pkg/metrics/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ var (
Subsystem: LabelBackend,
Name: "ping_duration_seconds",
Help: "Time (s) of pinging the SQL port of each backend.",
}, []string{LblBackend, LblRes})
}, []string{LblBackend})
)
2 changes: 1 addition & 1 deletion pkg/metrics/grafana/tiproxy_summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@
"expr": "tiproxy_backend_get_backend{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{res}}",
"legendFormat": "{{instance}} : {{res}}",
"refId": "A"
}
],
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/grafana/tiproxy_summary.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ local bGetBeP = graphPanel.new(
.addTarget(
prometheus.target(
'tiproxy_backend_get_backend{k8s_cluster="$k8s_cluster", tidb_cluster="$tidb_cluster"}',
legendFormat='{{res}}',
legendFormat='{{instance}} : {{res}}',
)
);

Expand Down

0 comments on commit 8bbb0e9

Please sign in to comment.