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
547bf75b
Commit
547bf75b
authored
Jan 05, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19258 from gmarek/metrics-grabber
Auto commit by PR queue bot
parents
f2b898a8
03fc8ba4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
33 deletions
+44
-33
framework.go
test/e2e/framework.go
+13
-29
metrics_util.go
test/e2e/metrics_util.go
+31
-4
No files found.
test/e2e/framework.go
View file @
547bf75b
...
@@ -161,22 +161,6 @@ func (f *Framework) afterEach() {
...
@@ -161,22 +161,6 @@ func (f *Framework) afterEach() {
summaries
=
append
(
summaries
,
f
.
logsSizeVerifier
.
GetSummary
())
summaries
=
append
(
summaries
,
f
.
logsSizeVerifier
.
GetSummary
())
}
}
outputTypes
:=
strings
.
Split
(
testContext
.
OutputPrintType
,
","
)
for
_
,
printType
:=
range
outputTypes
{
switch
printType
{
case
"hr"
:
for
i
:=
range
summaries
{
Logf
(
summaries
[
i
]
.
PrintHumanReadable
())
}
case
"json"
:
for
i
:=
range
summaries
{
Logf
(
summaries
[
i
]
.
PrintJSON
())
}
default
:
Logf
(
"Unknown ouptut type: %v. Skipping."
,
printType
)
}
}
if
testContext
.
GatherMetricsAfterTest
{
if
testContext
.
GatherMetricsAfterTest
{
// TODO: enable Scheduler and ControllerManager metrics grabbing when Master's Kubelet will be registered.
// TODO: enable Scheduler and ControllerManager metrics grabbing when Master's Kubelet will be registered.
grabber
,
err
:=
metrics
.
NewMetricsGrabber
(
f
.
Client
,
true
,
false
,
false
,
true
)
grabber
,
err
:=
metrics
.
NewMetricsGrabber
(
f
.
Client
,
true
,
false
,
false
,
true
)
...
@@ -187,24 +171,24 @@ func (f *Framework) afterEach() {
...
@@ -187,24 +171,24 @@ func (f *Framework) afterEach() {
if
err
!=
nil
{
if
err
!=
nil
{
Logf
(
"MetricsGrabber failed grab metrics. Skipping metrics gathering."
)
Logf
(
"MetricsGrabber failed grab metrics. Skipping metrics gathering."
)
}
else
{
}
else
{
buf
:=
bytes
.
Buffer
{}
summaries
=
append
(
summaries
,
(
*
metricsForE2E
)(
&
received
))
for
interestingMetric
:=
range
InterestingApiServerMetrics
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"For %v:
\n
"
,
interestingMetric
))
for
_
,
sample
:=
range
received
.
ApiServerMetrics
[
interestingMetric
]
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"
\t
%v
\n
"
,
metrics
.
PrintSample
(
sample
)))
}
}
}
for
kubelet
,
grabbed
:=
range
received
.
KubeletMetrics
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"For %v:
\n
"
,
kubelet
))
for
interestingMetric
:=
range
InterestingKubeletMetrics
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"
\t
For %v:
\n
"
,
interestingMetric
))
for
_
,
sample
:=
range
grabbed
[
interestingMetric
]
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"
\t\t
%v
\n
"
,
metrics
.
PrintSample
(
sample
)))
}
}
}
}
outputTypes
:=
strings
.
Split
(
testContext
.
OutputPrintType
,
","
)
for
_
,
printType
:=
range
outputTypes
{
switch
printType
{
case
"hr"
:
for
i
:=
range
summaries
{
Logf
(
summaries
[
i
]
.
PrintHumanReadable
())
}
}
Logf
(
"%v"
,
buf
.
String
())
case
"json"
:
for
i
:=
range
summaries
{
Logf
(
summaries
[
i
]
.
PrintJSON
())
}
}
default
:
Logf
(
"Unknown ouptut type: %v. Skipping."
,
printType
)
}
}
}
}
...
...
test/e2e/metrics_util.go
View file @
547bf75b
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/master/ports"
"k8s.io/kubernetes/pkg/master/ports"
"k8s.io/kubernetes/pkg/metrics"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/expfmt"
...
@@ -46,7 +47,33 @@ const (
...
@@ -46,7 +47,33 @@ const (
apiCallLatencyLargeThreshold
time
.
Duration
=
1
*
time
.
Second
apiCallLatencyLargeThreshold
time
.
Duration
=
1
*
time
.
Second
)
)
var
InterestingApiServerMetrics
=
sets
.
NewString
(
type
metricsForE2E
metrics
.
MetricsCollection
func
(
m
*
metricsForE2E
)
PrintHumanReadable
()
string
{
buf
:=
bytes
.
Buffer
{}
for
_
,
interestingMetric
:=
range
InterestingApiServerMetrics
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"For %v:
\n
"
,
interestingMetric
))
for
_
,
sample
:=
range
(
*
m
)
.
ApiServerMetrics
[
interestingMetric
]
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"
\t
%v
\n
"
,
metrics
.
PrintSample
(
sample
)))
}
}
for
kubelet
,
grabbed
:=
range
(
*
m
)
.
KubeletMetrics
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"For %v:
\n
"
,
kubelet
))
for
_
,
interestingMetric
:=
range
InterestingKubeletMetrics
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"
\t
For %v:
\n
"
,
interestingMetric
))
for
_
,
sample
:=
range
grabbed
[
interestingMetric
]
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"
\t\t
%v
\n
"
,
metrics
.
PrintSample
(
sample
)))
}
}
}
return
buf
.
String
()
}
func
(
m
*
metricsForE2E
)
PrintJSON
()
string
{
return
"JSON printer not implemented for Metrics"
}
var
InterestingApiServerMetrics
=
[]
string
{
"apiserver_request_count"
,
"apiserver_request_count"
,
"apiserver_request_latencies_bucket"
,
"apiserver_request_latencies_bucket"
,
"etcd_helper_cache_entry_count"
,
"etcd_helper_cache_entry_count"
,
...
@@ -62,9 +89,9 @@ var InterestingApiServerMetrics = sets.NewString(
...
@@ -62,9 +89,9 @@ var InterestingApiServerMetrics = sets.NewString(
"process_resident_memory_bytes"
,
"process_resident_memory_bytes"
,
"process_start_time_seconds"
,
"process_start_time_seconds"
,
"process_virtual_memory_bytes"
,
"process_virtual_memory_bytes"
,
)
}
var
InterestingKubeletMetrics
=
sets
.
NewString
(
var
InterestingKubeletMetrics
=
[]
string
{
"container_cpu_system_seconds_total"
,
"container_cpu_system_seconds_total"
,
"container_cpu_user_seconds_total"
,
"container_cpu_user_seconds_total"
,
"container_fs_io_time_weighted_seconds_total"
,
"container_fs_io_time_weighted_seconds_total"
,
...
@@ -86,7 +113,7 @@ var InterestingKubeletMetrics = sets.NewString(
...
@@ -86,7 +113,7 @@ var InterestingKubeletMetrics = sets.NewString(
"process_resident_memory_bytes"
,
"process_resident_memory_bytes"
,
"process_start_time_seconds"
,
"process_start_time_seconds"
,
"process_virtual_memory_bytes"
,
"process_virtual_memory_bytes"
,
)
}
// Dashboard metrics
// Dashboard metrics
type
LatencyMetric
struct
{
type
LatencyMetric
struct
{
...
...
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