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
50a10706
Commit
50a10706
authored
Mar 20, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graphite: Fixed issue with using series ref and series by tag, fixes #15237
parent
30f0c350
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
18 deletions
+13
-18
public/app/plugins/datasource/graphite/graphite_query.ts
+1
-1
public/app/plugins/datasource/graphite/specs/graphite_query.test.ts
+12
-0
public/app/plugins/datasource/graphite/specs/query_ctrl.test.ts
+0
-17
No files found.
public/app/plugins/datasource/graphite/graphite_query.ts
View file @
50a10706
...
@@ -98,7 +98,7 @@ export default class GraphiteQuery {
...
@@ -98,7 +98,7 @@ export default class GraphiteQuery {
this
.
functions
.
push
(
innerFunc
);
this
.
functions
.
push
(
innerFunc
);
break
;
break
;
case
'series-ref'
:
case
'series-ref'
:
if
(
this
.
segments
.
length
>
0
)
{
if
(
this
.
segments
.
length
>
0
||
this
.
getSeriesByTagFuncIndex
()
>=
0
)
{
this
.
addFunctionParameter
(
func
,
astNode
.
value
);
this
.
addFunctionParameter
(
func
,
astNode
.
value
);
}
else
{
}
else
{
this
.
segments
.
push
(
astNode
);
this
.
segments
.
push
(
astNode
);
...
...
public/app/plugins/datasource/graphite/specs/graphite_query.test.ts
View file @
50a10706
...
@@ -44,4 +44,16 @@ describe('Graphite query model', () => {
...
@@ -44,4 +44,16 @@ describe('Graphite query model', () => {
expect
(
ctx
.
queryModel
.
target
.
targetFull
).
toBeDefined
();
expect
(
ctx
.
queryModel
.
target
.
targetFull
).
toBeDefined
();
});
});
});
});
describe
(
'when query seriesByTag and series ref'
,
()
=>
{
beforeEach
(()
=>
{
ctx
.
target
=
{
refId
:
'A'
,
target
:
`group(seriesByTag('namespace=asd'), #A)`
};
ctx
.
targets
=
[
ctx
.
target
];
ctx
.
queryModel
=
new
GraphiteQuery
(
ctx
.
datasource
,
ctx
.
target
,
ctx
.
templateSrv
);
});
it
(
'should keep group function series ref'
,
()
=>
{
expect
(
ctx
.
queryModel
.
functions
[
1
].
params
[
0
]).
toBe
(
'#A'
);
});
});
});
});
public/app/plugins/datasource/graphite/specs/query_ctrl.test.ts
View file @
50a10706
...
@@ -24,7 +24,6 @@ describe('GraphiteQueryCtrl', () => {
...
@@ -24,7 +24,6 @@ describe('GraphiteQueryCtrl', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
GraphiteQueryCtrl
.
prototype
.
target
=
ctx
.
target
;
GraphiteQueryCtrl
.
prototype
.
target
=
ctx
.
target
;
GraphiteQueryCtrl
.
prototype
.
datasource
=
ctx
.
datasource
;
GraphiteQueryCtrl
.
prototype
.
datasource
=
ctx
.
datasource
;
GraphiteQueryCtrl
.
prototype
.
panelCtrl
=
ctx
.
panelCtrl
;
GraphiteQueryCtrl
.
prototype
.
panelCtrl
=
ctx
.
panelCtrl
;
ctx
.
ctrl
=
new
GraphiteQueryCtrl
(
ctx
.
ctrl
=
new
GraphiteQueryCtrl
(
...
@@ -84,22 +83,6 @@ describe('GraphiteQueryCtrl', () => {
...
@@ -84,22 +83,6 @@ describe('GraphiteQueryCtrl', () => {
});
});
});
});
describe
(
'when initializing target without metric expression and only function'
,
()
=>
{
beforeEach
(()
=>
{
ctx
.
ctrl
.
target
.
target
=
'asPercent(#A, #B)'
;
ctx
.
ctrl
.
datasource
.
metricFindQuery
=
()
=>
Promise
.
resolve
([]);
ctx
.
ctrl
.
parseTarget
();
});
it
(
'should not add select metric segment'
,
()
=>
{
expect
(
ctx
.
ctrl
.
segments
.
length
).
toBe
(
1
);
});
it
(
'should add second series ref as param'
,
()
=>
{
expect
(
ctx
.
ctrl
.
queryModel
.
functions
[
0
].
params
.
length
).
toBe
(
1
);
});
});
describe
(
'when initializing a target with single param func using variable'
,
()
=>
{
describe
(
'when initializing a target with single param func using variable'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
ctx
.
ctrl
.
target
.
target
=
'movingAverage(prod.count, $var)'
;
ctx
.
ctrl
.
target
.
target
=
'movingAverage(prod.count, $var)'
;
...
...
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