-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
timer,ttl: add some metrics for timer framework and TTL timer syncing (…
- Loading branch information
1 parent
50e4911
commit 6d6547a
Showing
15 changed files
with
264 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "metrics", | ||
srcs = ["metrics.go"], | ||
importpath = "github.com/pingcap/tidb/timer/metrics", | ||
visibility = ["//visibility:public"], | ||
deps = ["@com_github_prometheus_client_golang//prometheus"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2023 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. | ||
|
||
package metrics | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
// Timer metrics | ||
var ( | ||
TimerEventCounter *prometheus.CounterVec | ||
|
||
TimerFullRefreshCounter prometheus.Counter | ||
TimerPartialRefreshCounter prometheus.Counter | ||
) | ||
|
||
// InitTimerMetrics initializes timers metrics. | ||
func InitTimerMetrics() { | ||
TimerEventCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "tidb", | ||
Subsystem: "server", | ||
Name: "timer_event_count", | ||
Help: "Counter of timer event.", | ||
}, []string{"scope", "type"}) | ||
|
||
rtScope := "runtime" | ||
TimerFullRefreshCounter = TimerEventCounter.WithLabelValues(rtScope, "full_refresh_timers") | ||
TimerPartialRefreshCounter = TimerEventCounter.WithLabelValues(rtScope, "partial_refresh_timers") | ||
} | ||
|
||
// TimerHookWorkerCounter creates a counter for a hook's event | ||
func TimerHookWorkerCounter(hookClass string, event string) prometheus.Counter { | ||
return TimerEventCounter.WithLabelValues(fmt.Sprintf("hook.%s", hookClass), event) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.