Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0a0835e9
Commit
0a0835e9
authored
Feb 04, 2019
by
wojtekt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add metric exposing amount of processed init events in watchcache
parent
999e2e0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
BUILD
staging/src/k8s.io/apiserver/pkg/storage/cacher/BUILD
+1
-0
cacher.go
staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go
+20
-0
metrics_util.go
test/e2e/framework/metrics_util.go
+1
-6
No files found.
staging/src/k8s.io/apiserver/pkg/storage/cacher/BUILD
View file @
0a0835e9
...
...
@@ -27,6 +27,7 @@ go_library(
"//staging/src/k8s.io/apiserver/pkg/storage:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
"//vendor/k8s.io/utils/trace:go_default_library",
],
...
...
staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go
View file @
0a0835e9
...
...
@@ -41,8 +41,24 @@ import (
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/tools/cache"
utiltrace
"k8s.io/utils/trace"
"github.com/prometheus/client_golang/prometheus"
)
var
(
initCounter
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Name
:
"apiserver_init_events_total"
,
Help
:
"Counter of init events processed in watchcache broken by resource type"
,
},
[]
string
{
"resource"
},
)
)
func
init
()
{
prometheus
.
MustRegister
(
initCounter
)
}
// Config contains the configuration for a given Cache.
type
Config
struct
{
// Maximum size of the history cached in memory.
...
...
@@ -941,6 +957,10 @@ func (c *cacheWatcher) process(initEvents []*watchCacheEvent, resourceVersion ui
for
_
,
event
:=
range
initEvents
{
c
.
sendWatchCacheEvent
(
event
)
}
if
len
(
initEvents
)
>
0
{
objType
:=
reflect
.
TypeOf
(
initEvents
[
0
]
.
Object
)
.
String
()
initCounter
.
WithLabelValues
(
objType
)
.
Add
(
float64
(
len
(
initEvents
)))
}
processingTime
:=
time
.
Since
(
startTime
)
if
processingTime
>
initProcessThreshold
{
objType
:=
"<null>"
...
...
test/e2e/framework/metrics_util.go
View file @
0a0835e9
...
...
@@ -140,12 +140,7 @@ var InterestingApiServerMetrics = []string{
// TODO(krzysied): apiserver_request_latencies_summary is a deprecated metric.
// It should be replaced with new metric.
"apiserver_request_latencies_summary"
,
"etcd_helper_cache_entry_total"
,
"etcd_helper_cache_hit_total"
,
"etcd_helper_cache_miss_total"
,
"etcd_request_cache_add_latency_seconds"
,
"etcd_request_cache_get_latency_seconds"
,
"etcd_request_latency_seconds"
,
"apiserver_init_events_total"
,
}
var
InterestingControllerManagerMetrics
=
[]
string
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment