mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #90200 from gongguan/capacity-metric
move watchCache metrics to a seperate file
This commit is contained in:
commit
8fa7931159
@ -5,6 +5,7 @@ go_library(
|
|||||||
srcs = [
|
srcs = [
|
||||||
"cacher.go",
|
"cacher.go",
|
||||||
"caching_object.go",
|
"caching_object.go",
|
||||||
|
"metrics.go",
|
||||||
"time_budget.go",
|
"time_budget.go",
|
||||||
"util.go",
|
"util.go",
|
||||||
"watch_cache.go",
|
"watch_cache.go",
|
||||||
|
@ -39,29 +39,11 @@ import (
|
|||||||
"k8s.io/apiserver/pkg/storage"
|
"k8s.io/apiserver/pkg/storage"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/component-base/metrics"
|
|
||||||
"k8s.io/component-base/metrics/legacyregistry"
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
utiltrace "k8s.io/utils/trace"
|
utiltrace "k8s.io/utils/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
|
||||||
* By default, all the following metrics are defined as falling under
|
|
||||||
* ALPHA stability level https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/20190404-kubernetes-control-plane-metrics-stability.md#stability-classes)
|
|
||||||
*
|
|
||||||
* Promoting the stability level of the metric is a responsibility of the component owner, since it
|
|
||||||
* involves explicitly acknowledging support for the metric across multiple releases, in accordance with
|
|
||||||
* the metric stability policy.
|
|
||||||
*/
|
|
||||||
var (
|
var (
|
||||||
initCounter = metrics.NewCounterVec(
|
|
||||||
&metrics.CounterOpts{
|
|
||||||
Name: "apiserver_init_events_total",
|
|
||||||
Help: "Counter of init events processed in watchcache broken by resource type",
|
|
||||||
StabilityLevel: metrics.ALPHA,
|
|
||||||
},
|
|
||||||
[]string{"resource"},
|
|
||||||
)
|
|
||||||
emptyFunc = func() {}
|
emptyFunc = func() {}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -71,10 +53,6 @@ const (
|
|||||||
storageWatchListPageSize = int64(10000)
|
storageWatchListPageSize = int64(10000)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
legacyregistry.MustRegister(initCounter)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Config contains the configuration for a given Cache.
|
// Config contains the configuration for a given Cache.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Maximum size of the history cached in memory.
|
// Maximum size of the history cached in memory.
|
||||||
|
45
staging/src/k8s.io/apiserver/pkg/storage/cacher/metrics.go
Normal file
45
staging/src/k8s.io/apiserver/pkg/storage/cacher/metrics.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
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 cacher
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/component-base/metrics"
|
||||||
|
"k8s.io/component-base/metrics/legacyregistry"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By default, all the following metrics are defined as falling under
|
||||||
|
* ALPHA stability level https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/20190404-kubernetes-control-plane-metrics-stability.md#stability-classes)
|
||||||
|
*
|
||||||
|
* Promoting the stability level of the metric is a responsibility of the component owner, since it
|
||||||
|
* involves explicitly acknowledging support for the metric across multiple releases, in accordance with
|
||||||
|
* the metric stability policy.
|
||||||
|
*/
|
||||||
|
var (
|
||||||
|
initCounter = metrics.NewCounterVec(
|
||||||
|
&metrics.CounterOpts{
|
||||||
|
Name: "apiserver_init_events_total",
|
||||||
|
Help: "Counter of init events processed in watchcache broken by resource type",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
|
},
|
||||||
|
[]string{"resource"},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
legacyregistry.MustRegister(initCounter)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user