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
377bc440
Commit
377bc440
authored
Sep 20, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: dont rate-hint on rate queries
parent
4a8d80a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
public/app/plugins/datasource/prometheus/datasource.ts
+1
-1
public/app/plugins/datasource/prometheus/specs/datasource.test.ts
+6
-0
No files found.
public/app/plugins/datasource/prometheus/datasource.ts
View file @
377bc440
...
@@ -46,7 +46,7 @@ export function determineQueryHints(series: any[], datasource?: any): any[] {
...
@@ -46,7 +46,7 @@ export function determineQueryHints(series: any[], datasource?: any): any[] {
// Check for monotony
// Check for monotony
const
datapoints
:
number
[][]
=
s
.
datapoints
;
const
datapoints
:
number
[][]
=
s
.
datapoints
;
if
(
datapoints
.
length
>
1
)
{
if
(
query
.
indexOf
(
'rate('
)
===
-
1
&&
datapoints
.
length
>
1
)
{
let
increasing
=
false
;
let
increasing
=
false
;
const
monotonic
=
datapoints
.
filter
(
dp
=>
dp
[
0
]
!==
null
).
every
((
dp
,
index
)
=>
{
const
monotonic
=
datapoints
.
filter
(
dp
=>
dp
[
0
]
!==
null
).
every
((
dp
,
index
)
=>
{
if
(
index
===
0
)
{
if
(
index
===
0
)
{
...
...
public/app/plugins/datasource/prometheus/specs/datasource.test.ts
View file @
377bc440
...
@@ -247,6 +247,12 @@ describe('PrometheusDatasource', () => {
...
@@ -247,6 +247,12 @@ describe('PrometheusDatasource', () => {
});
});
});
});
it
(
'returns no rate hint for a monotonously increasing series that already has a rate'
,
()
=>
{
const
series
=
[{
datapoints
:
[[
23
,
1000
],
[
24
,
1001
]],
query
:
'rate(metric[1m])'
,
responseIndex
:
0
}];
const
hints
=
determineQueryHints
(
series
);
expect
(
hints
).
toEqual
([
null
]);
});
it
(
'returns a rate hint w/o action for a complex monotonously increasing series'
,
()
=>
{
it
(
'returns a rate hint w/o action for a complex monotonously increasing series'
,
()
=>
{
const
series
=
[{
datapoints
:
[[
23
,
1000
],
[
24
,
1001
]],
query
:
'sum(metric)'
,
responseIndex
:
0
}];
const
series
=
[{
datapoints
:
[[
23
,
1000
],
[
24
,
1001
]],
query
:
'sum(metric)'
,
responseIndex
:
0
}];
const
hints
=
determineQueryHints
(
series
);
const
hints
=
determineQueryHints
(
series
);
...
...
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