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
79cef8a4
Commit
79cef8a4
authored
Apr 28, 2017
by
Aleksandra Malinowska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging missing metrics & extend timeout
parent
0597a85f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
stackdriver_monitoring.go
test/e2e/stackdriver_monitoring.go
+19
-4
No files found.
test/e2e/stackdriver_monitoring.go
View file @
79cef8a4
...
...
@@ -48,7 +48,7 @@ var (
}
pollFrequency
=
time
.
Second
*
5
pollTimeout
=
time
.
Minute
*
7
pollTimeout
=
time
.
Minute
*
20
rcName
=
"resource-consumer"
replicas
=
1
...
...
@@ -79,22 +79,34 @@ var _ = framework.KubeDescribe("Stackdriver Monitoring", func() {
rc
.
WaitForReplicas
(
replicas
)
pollingFunction
:=
checkForMetrics
(
projectId
,
gcmService
,
time
.
Now
())
framework
.
ExpectNoError
(
wait
.
Poll
(
pollFrequency
,
pollTimeout
,
pollingFunction
))
metricsMap
:=
map
[
string
]
bool
{}
pollingFunction
:=
checkForMetrics
(
projectId
,
gcmService
,
time
.
Now
(),
metricsMap
)
err
=
wait
.
Poll
(
pollFrequency
,
pollTimeout
,
pollingFunction
)
if
err
!=
nil
{
framework
.
Logf
(
"Missing metrics: %+v
\n
"
,
metricsMap
)
}
framework
.
ExpectNoError
(
err
)
})
})
func
checkForMetrics
(
projectId
string
,
gcmService
*
gcm
.
Service
,
start
time
.
Time
)
func
()
(
bool
,
error
)
{
func
checkForMetrics
(
projectId
string
,
gcmService
*
gcm
.
Service
,
start
time
.
Time
,
metricsMap
map
[
string
]
bool
)
func
()
(
bool
,
error
)
{
return
func
()
(
bool
,
error
)
{
// TODO: list which metrics are missing in case of failure
counter
:=
0
correctUtilization
:=
false
for
_
,
metric
:=
range
stackdriverMetrics
{
metricsMap
[
metric
]
=
false
}
for
_
,
metric
:=
range
stackdriverMetrics
{
// TODO: check only for metrics from this cluster
ts
,
err
:=
fetchTimeSeries
(
projectId
,
gcmService
,
metric
,
start
,
time
.
Now
())
framework
.
ExpectNoError
(
err
)
if
len
(
ts
)
>
0
{
counter
=
counter
+
1
metricsMap
[
metric
]
=
true
framework
.
Logf
(
"Received %v timeseries for metric %v
\n
"
,
len
(
ts
),
metric
)
}
else
{
framework
.
Logf
(
"No timeseries for metric %v
\n
"
,
metric
)
}
var
sum
float64
=
0
...
...
@@ -111,7 +123,10 @@ func checkForMetrics(projectId string, gcmService *gcm.Service, start time.Time)
}
}
sum
=
sum
+
*
max
.
Value
.
DoubleValue
framework
.
Logf
(
"Received %v points for metric %v
\n
"
,
len
(
t
.
Points
),
metric
)
}
framework
.
Logf
(
"Most recent cpu/utilization sum: %v
\n
"
,
sum
)
if
math
.
Abs
(
sum
*
float64
(
cpuLimit
)
-
float64
(
cpuUsed
))
>
tolerance
*
float64
(
cpuUsed
)
{
return
false
,
nil
}
else
{
...
...
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