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
cf074889
Commit
cf074889
authored
Sep 29, 2015
by
Jimmi Dyson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prometheus template params fixes
parent
6e66b8a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
public/app/plugins/datasource/prometheus/datasource.js
+13
-4
No files found.
public/app/plugins/datasource/prometheus/datasource.js
View file @
cf074889
...
...
@@ -130,8 +130,16 @@ function (angular, _, moment, dateMath) {
PrometheusDatasource
.
prototype
.
metricFindQuery
=
function
(
query
)
{
var
url
;
var
metricsQuery
=
query
.
match
(
/^
[
a-zA-Z_:*
][
a-zA-Z0-9_:*
]
*/
);
var
labelValuesQuery
=
query
.
match
(
/^label_values
\((
.+
)\)
/
);
var
interpolated
;
try
{
interpolated
=
templateSrv
.
replace
(
query
);
}
catch
(
err
)
{
return
$q
.
reject
(
err
);
}
var
metricsQuery
=
interpolated
.
match
(
/^
[
a-zA-Z_:*
][
a-zA-Z0-9_:*
]
*/
);
var
labelValuesQuery
=
interpolated
.
match
(
/^label_values
\((
.+
)\)
/
);
if
(
labelValuesQuery
)
{
// return label values
...
...
@@ -163,11 +171,12 @@ function (angular, _, moment, dateMath) {
});
}
else
{
// if query contains full metric name, return metric name and label list
url
=
'/api/v1/query?query='
+
encodeURIComponent
(
query
);
url
=
'/api/v1/query?query='
+
encodeURIComponent
(
interpolated
)
+
'&time='
+
(
moment
().
valueOf
()
/
1000
);
return
this
.
_request
(
'GET'
,
url
)
.
then
(
function
(
result
)
{
return
_
.
map
(
result
.
data
.
result
,
function
(
metricData
)
{
return
_
.
map
(
result
.
data
.
data
.
result
,
function
(
metricData
)
{
return
{
text
:
getOriginalMetricName
(
metricData
.
metric
),
expandable
:
true
...
...
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