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
95856e30
Unverified
Commit
95856e30
authored
Feb 22, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73820 from haiyanmeng/runtimeclass
Fit RuntimeClass metrics to prometheus conventions
parents
3afa0031
ec18200f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
instrumented_services.go
pkg/kubelet/kuberuntime/instrumented_services.go
+1
-1
metrics.go
pkg/kubelet/metrics/metrics.go
+9
-7
No files found.
pkg/kubelet/kuberuntime/instrumented_services.go
View file @
95856e30
...
...
@@ -183,7 +183,7 @@ func (in instrumentedRuntimeService) RunPodSandbox(config *runtimeapi.PodSandbox
const
operation
=
"run_podsandbox"
startTime
:=
time
.
Now
()
defer
recordOperation
(
operation
,
startTime
)
defer
metrics
.
RunPodSandbox
Latencies
.
WithLabelValues
(
runtimeHandler
)
.
Observe
(
metrics
.
SinceInMicros
econds
(
startTime
))
defer
metrics
.
RunPodSandbox
Duration
.
WithLabelValues
(
runtimeHandler
)
.
Observe
(
metrics
.
SinceInS
econds
(
startTime
))
out
,
err
:=
in
.
service
.
RunPodSandbox
(
config
,
runtimeHandler
)
recordError
(
operation
,
err
)
...
...
pkg/kubelet/metrics/metrics.go
View file @
95856e30
...
...
@@ -80,8 +80,8 @@ const (
KubeletConfigKeyLabelKey
=
"node_config_kubelet_key"
// Metrics keys for RuntimeClass
RunPodSandbox
LatenciesKey
=
"run_podsandbox_latencie
s"
RunPodSandboxErrorsKey
=
"run_podsandbox_errors
"
RunPodSandbox
DurationKey
=
"run_podsandbox_duration_second
s"
RunPodSandboxErrorsKey
=
"run_podsandbox_errors_total
"
)
var
(
...
...
@@ -338,11 +338,13 @@ var (
Help
:
"This metric is true (1) if the node is experiencing a configuration-related error, false (0) otherwise."
,
},
)
RunPodSandbox
Latencies
=
prometheus
.
NewSummary
Vec
(
prometheus
.
Summary
Opts
{
RunPodSandbox
Duration
=
prometheus
.
NewHistogram
Vec
(
prometheus
.
Histogram
Opts
{
Subsystem
:
KubeletSubsystem
,
Name
:
RunPodSandboxLatenciesKey
,
Help
:
"Latencies in microseconds of the run_podsandbox operations. Broken down by RuntimeClass."
,
Name
:
RunPodSandboxDurationKey
,
Help
:
"Duration in seconds of the run_podsandbox operations. Broken down by RuntimeClass."
,
// Use DefBuckets for now, will customize the buckets if necessary.
Buckets
:
prometheus
.
DefBuckets
,
},
[]
string
{
"runtime_handler"
},
)
...
...
@@ -407,7 +409,7 @@ func SinceInMicroseconds(start time.Time) float64 {
return
float64
(
time
.
Since
(
start
)
.
Nanoseconds
()
/
time
.
Microsecond
.
Nanoseconds
())
}
//
G
ets the time since the specified start in seconds.
//
SinceInSeconds g
ets the time since the specified start in seconds.
func
SinceInSeconds
(
start
time
.
Time
)
float64
{
return
time
.
Since
(
start
)
.
Seconds
()
}
...
...
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