Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e8a6af7b
Commit
e8a6af7b
authored
Dec 03, 2017
by
Mitsuhiro Tanda
Committed by
Torkel Ödegaard
Dec 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix templating undefined error (#10004)
parent
d6d64c53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
public/app/plugins/datasource/prometheus/metric_find_query.ts
+2
-2
public/app/plugins/datasource/prometheus/specs/metric_find_query_specs.ts
+18
-0
No files found.
public/app/plugins/datasource/prometheus/metric_find_query.ts
View file @
e8a6af7b
...
...
@@ -67,8 +67,8 @@ export default class PrometheusMetricFindQuery {
return
this
.
datasource
.
_request
(
"GET"
,
url
).
then
(
function
(
result
)
{
var
_labels
=
_
.
map
(
result
.
data
.
data
,
function
(
metric
)
{
return
metric
[
label
];
});
return
metric
[
label
]
||
''
;
})
.
filter
(
function
(
label
)
{
return
label
!==
''
;
})
;
return
_
.
uniq
(
_labels
).
map
(
function
(
metric
)
{
return
{
...
...
public/app/plugins/datasource/prometheus/specs/metric_find_query_specs.ts
View file @
e8a6af7b
...
...
@@ -76,6 +76,24 @@ describe('PrometheusMetricFindQuery', function() {
ctx
.
$rootScope
.
$apply
();
expect
(
results
.
length
).
to
.
be
(
3
);
});
it
(
'label_values(metric, resource) result should not contain empty string'
,
function
()
{
response
=
{
status
:
"success"
,
data
:
[
{
__name__
:
"metric"
,
resource
:
"value1"
},
{
__name__
:
"metric"
,
resource
:
"value2"
},
{
__name__
:
"metric"
,
resource
:
""
}
]
};
ctx
.
$httpBackend
.
expect
(
'GET'
,
/proxied
\/
api
\/
v1
\/
series
\?
match
\[\]
=metric&start=.*&end=.*/
).
respond
(
response
);
var
pm
=
new
PrometheusMetricFindQuery
(
ctx
.
ds
,
'label_values(metric, resource)'
,
ctx
.
timeSrv
);
pm
.
process
().
then
(
function
(
data
)
{
results
=
data
;
});
ctx
.
$httpBackend
.
flush
();
ctx
.
$rootScope
.
$apply
();
expect
(
results
.
length
).
to
.
be
(
2
);
expect
(
results
[
0
].
text
).
to
.
be
(
"value1"
);
expect
(
results
[
1
].
text
).
to
.
be
(
"value2"
);
});
it
(
'metrics(metric.*) should generate metric name query'
,
function
()
{
response
=
{
status
:
"success"
,
...
...
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