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
603725ae
Unverified
Commit
603725ae
authored
Nov 30, 2017
by
Carl Bergquist
Committed by
GitHub
Nov 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10041 from grafana/revert-9983-prometheus_nested
Revert "prometheus nested query support"
parents
98f0305e
af5ced0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
23 deletions
+0
-23
public/app/plugins/datasource/prometheus/datasource.ts
+0
-8
public/app/plugins/datasource/prometheus/specs/datasource_specs.ts
+0
-15
No files found.
public/app/plugins/datasource/prometheus/datasource.ts
View file @
603725ae
...
@@ -157,7 +157,6 @@ export class PrometheusDatasource {
...
@@ -157,7 +157,6 @@ export class PrometheusDatasource {
// Only replace vars in expression after having (possibly) updated interval vars
// Only replace vars in expression after having (possibly) updated interval vars
query
.
expr
=
this
.
templateSrv
.
replace
(
target
.
expr
,
scopedVars
,
this
.
interpolateQueryExpr
);
query
.
expr
=
this
.
templateSrv
.
replace
(
target
.
expr
,
scopedVars
,
this
.
interpolateQueryExpr
);
query
.
expr
=
this
.
replaceNestedQuery
(
query
.
expr
,
options
);
query
.
requestId
=
options
.
panelId
+
target
.
refId
;
query
.
requestId
=
options
.
panelId
+
target
.
refId
;
return
query
;
return
query
;
}
}
...
@@ -272,13 +271,6 @@ export class PrometheusDatasource {
...
@@ -272,13 +271,6 @@ export class PrometheusDatasource {
});
});
}
}
replaceNestedQuery
(
query
,
options
)
{
return
query
.
replace
(
/
\#([
A-Z
])
/g
,
(
match
,
g1
)
=>
{
let
replaceTarget
=
options
.
targets
.
find
((
t
)
=>
{
return
t
.
refId
===
g1
;
});
return
replaceTarget
?
replaceTarget
.
expr
:
match
;
});
}
transformMetricData
(
md
,
options
,
start
,
end
,
step
)
{
transformMetricData
(
md
,
options
,
start
,
end
,
step
)
{
var
dps
=
[],
var
dps
=
[],
metricLabel
=
null
;
metricLabel
=
null
;
...
...
public/app/plugins/datasource/prometheus/specs/datasource_specs.ts
View file @
603725ae
...
@@ -590,19 +590,4 @@ describe('PrometheusDatasource', function() {
...
@@ -590,19 +590,4 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
5
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
5
*
1000
);
});
});
});
});
describe
(
'The nested query'
,
function
()
{
it
(
'should generate correct query'
,
function
()
{
let
query
=
'sum(rate(#A[1m]))'
;
let
options
=
{
targets
:
[
{
refId
:
'A'
,
expr
:
'http_requests_total'
}
]
};
let
result
=
ctx
.
ds
.
replaceNestedQuery
(
query
,
options
);
expect
(
result
).
to
.
be
(
'sum(rate(http_requests_total[1m]))'
);
});
});
});
});
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