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
03fc8ba4
Commit
03fc8ba4
authored
Jan 04, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Metrics in e2e tests are using printer framework to print themselves
parent
f293dff5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
35 deletions
+46
-35
framework.go
test/e2e/framework.go
+15
-31
metrics_util.go
test/e2e/metrics_util.go
+31
-4
No files found.
test/e2e/framework.go
View file @
03fc8ba4
...
@@ -161,6 +161,21 @@ func (f *Framework) afterEach() {
...
@@ -161,6 +161,21 @@ func (f *Framework) afterEach() {
summaries
=
append
(
summaries
,
f
.
logsSizeVerifier
.
GetSummary
())
summaries
=
append
(
summaries
,
f
.
logsSizeVerifier
.
GetSummary
())
}
}
if
testContext
.
GatherMetricsAfterTest
{
// TODO: enable Scheduler and ControllerManager metrics grabbing when Master's Kubelet will be registered.
grabber
,
err
:=
metrics
.
NewMetricsGrabber
(
f
.
Client
,
true
,
false
,
false
,
true
)
if
err
!=
nil
{
Logf
(
"Failed to create MetricsGrabber. Skipping metrics gathering."
)
}
else
{
received
,
err
:=
grabber
.
Grab
(
nil
)
if
err
!=
nil
{
Logf
(
"MetricsGrabber failed grab metrics. Skipping metrics gathering."
)
}
else
{
summaries
=
append
(
summaries
,
(
*
metricsForE2E
)(
&
received
))
}
}
}
outputTypes
:=
strings
.
Split
(
testContext
.
OutputPrintType
,
","
)
outputTypes
:=
strings
.
Split
(
testContext
.
OutputPrintType
,
","
)
for
_
,
printType
:=
range
outputTypes
{
for
_
,
printType
:=
range
outputTypes
{
switch
printType
{
switch
printType
{
...
@@ -177,37 +192,6 @@ func (f *Framework) afterEach() {
...
@@ -177,37 +192,6 @@ func (f *Framework) afterEach() {
}
}
}
}
if
testContext
.
GatherMetricsAfterTest
{
// TODO: enable Scheduler and ControllerManager metrics grabbing when Master's Kubelet will be registered.
grabber
,
err
:=
metrics
.
NewMetricsGrabber
(
f
.
Client
,
true
,
false
,
false
,
true
)
if
err
!=
nil
{
Logf
(
"Failed to create MetricsGrabber. Skipping metrics gathering."
)
}
else
{
received
,
err
:=
grabber
.
Grab
(
nil
)
if
err
!=
nil
{
Logf
(
"MetricsGrabber failed grab metrics. Skipping metrics gathering."
)
}
else
{
buf
:=
bytes
.
Buffer
{}
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
)))
}
}
}
Logf
(
"%v"
,
buf
.
String
())
}
}
}
// Paranoia-- prevent reuse!
// Paranoia-- prevent reuse!
f
.
Namespace
=
nil
f
.
Namespace
=
nil
f
.
Client
=
nil
f
.
Client
=
nil
...
...
test/e2e/metrics_util.go
View file @
03fc8ba4
...
@@ -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