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
63e6496c
Commit
63e6496c
authored
May 17, 2018
by
Karol Wychowaniec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow for system metrics discovery in Custom Metrics - Stackdriver Adapter test
parent
5686fcfc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
custom_metrics_stackdriver.go
.../instrumentation/monitoring/custom_metrics_stackdriver.go
+11
-12
No files found.
test/e2e/instrumentation/monitoring/custom_metrics_stackdriver.go
View file @
63e6496c
...
...
@@ -175,20 +175,10 @@ func verifyResponsesFromCustomMetricsAPI(f *framework.Framework, customMetricsCl
if
err
!=
nil
{
framework
.
Failf
(
"Failed to retrieve a list of supported metrics: %s"
,
err
)
}
gotCustomMetric
,
gotUnusedMetric
:=
false
,
false
for
_
,
resource
:=
range
resources
.
APIResources
{
if
resource
.
Name
==
"*/"
+
CustomMetricName
{
gotCustomMetric
=
true
}
else
if
resource
.
Name
==
"*/"
+
UnusedMetricName
{
gotUnusedMetric
=
true
}
else
{
framework
.
Failf
(
"Unexpected metric %s. Only metric %s should be supported"
,
resource
.
Name
,
CustomMetricName
)
}
}
if
!
gotCustomMetric
{
if
!
containsResource
(
resources
.
APIResources
,
"*/custom.googleapis.com|"
+
CustomMetricName
)
{
framework
.
Failf
(
"Metric '%s' expected but not received"
,
CustomMetricName
)
}
if
!
gotUnusedMetric
{
if
!
containsResource
(
resources
.
APIResources
,
"*/custom.googleapis.com|"
+
UnusedMetricName
)
{
framework
.
Failf
(
"Metric '%s' expected but not received"
,
UnusedMetricName
)
}
value
,
err
:=
customMetricsClient
.
NamespacedMetrics
(
f
.
Namespace
.
Name
)
.
GetForObject
(
schema
.
GroupKind
{
Group
:
""
,
Kind
:
"Pod"
},
stackdriverExporterPod1
,
CustomMetricName
)
...
...
@@ -214,6 +204,15 @@ func verifyResponsesFromCustomMetricsAPI(f *framework.Framework, customMetricsCl
}
}
func
containsResource
(
resourcesList
[]
metav1
.
APIResource
,
resourceName
string
)
bool
{
for
_
,
resource
:=
range
resourcesList
{
if
resource
.
Name
==
resourceName
{
return
true
}
}
return
false
}
func
verifyResponseFromExternalMetricsAPI
(
f
*
framework
.
Framework
,
externalMetricsClient
externalclient
.
ExternalMetricsClient
,
pod
*
v1
.
Pod
)
{
req1
,
_
:=
labels
.
NewRequirement
(
"resource.type"
,
selection
.
Equals
,
[]
string
{
"gke_container"
})
// It's important to filter out only metrics from the right namespace, since multiple e2e tests
...
...
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