Skip to content

Commit

Permalink
metrics: add grafana panel (pingcap#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
djshow832 authored and xhebox committed Mar 13, 2023
1 parent 15d0207 commit f15a8a7
Show file tree
Hide file tree
Showing 8 changed files with 1,427 additions and 13 deletions.
8 changes: 4 additions & 4 deletions pkg/metrics/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ const (
var (
BackendStatusGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: ModuleWeirProxy,
Namespace: ModuleProxy,
Subsystem: LabelBalance,
Name: "b_status",
Help: "Gauge of backend status.",
}, []string{LblBackend, LblStatus})

BackendConnGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: ModuleWeirProxy,
Namespace: ModuleProxy,
Subsystem: LabelBalance,
Name: "b_conn",
Help: "Number of backend connections.",
}, []string{LblBackend})

MigrateCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: ModuleWeirProxy,
Namespace: ModuleProxy,
Subsystem: LabelBalance,
Name: "migrate_total",
Help: "Number and result of session migration.",
}, []string{LblFrom, LblTo, LblMigrateResult})

MigrateDurationHistogram = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: ModuleWeirProxy,
Namespace: ModuleProxy,
Subsystem: LabelBalance,
Name: "migrate_duration_millis",
Help: "Bucketed histogram of migrating time (s) of sessions.",
Expand Down
22 changes: 22 additions & 0 deletions pkg/metrics/grafana/generate_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Copyright 2022 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

go install github.com/google/go-jsonnet/cmd/jsonnet@latest
git clone https://github.com/grafana/grafonnet-lib.git --depth=1

export JSONNET_PATH=grafonnet-lib
jsonnet tiproxy_summary.jsonnet > tiproxy_summary.json
rm -rf $JSONNET_PATH

Loading

0 comments on commit f15a8a7

Please sign in to comment.