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
58a156ba
Commit
58a156ba
authored
Oct 11, 2018
by
Adam Palaniuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update check for invalid percentile statistics
parent
bcdda7b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
public/app/plugins/datasource/cloudwatch/datasource.ts
+7
-1
public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts
+2
-2
No files found.
public/app/plugins/datasource/cloudwatch/datasource.ts
View file @
58a156ba
...
@@ -44,7 +44,13 @@ export default class CloudWatchDatasource {
...
@@ -44,7 +44,13 @@ export default class CloudWatchDatasource {
// valid ExtendedStatistics is like p90.00, check the pattern
// valid ExtendedStatistics is like p90.00, check the pattern
const
hasInvalidStatistics
=
item
.
statistics
.
some
(
s
=>
{
const
hasInvalidStatistics
=
item
.
statistics
.
some
(
s
=>
{
return
s
.
indexOf
(
'p'
)
===
0
&&
!
/p
\d{2}\.\d{2}
/
.
test
(
s
);
if
(
s
.
indexOf
(
'p'
)
===
0
)
{
const
matches
=
/^p
\d{2}(?:\.\d{1,2})?
$/
.
exec
(
s
);
return
!
matches
||
matches
[
0
]
!==
s
;
}
return
false
;
});
});
if
(
hasInvalidStatistics
)
{
if
(
hasInvalidStatistics
)
{
throw
{
message
:
'Invalid extended statistics'
};
throw
{
message
:
'Invalid extended statistics'
};
...
...
public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts
View file @
58a156ba
...
@@ -122,7 +122,7 @@ describe('CloudWatchDatasource', () => {
...
@@ -122,7 +122,7 @@ describe('CloudWatchDatasource', () => {
});
});
});
});
it
(
'should cancel query for invalid extended statistics'
,
()
=>
{
it
.
each
([
'pNN.NN'
,
'p9'
,
'p99.'
,
'p99.999'
])(
'should cancel query for invalid extended statistics (%s)'
,
stat
=>
{
const
query
=
{
const
query
=
{
range
:
{
from
:
'now-1h'
,
to
:
'now'
},
range
:
{
from
:
'now-1h'
,
to
:
'now'
},
rangeRaw
:
{
from
:
1483228800
,
to
:
1483232400
},
rangeRaw
:
{
from
:
1483228800
,
to
:
1483232400
},
...
@@ -134,7 +134,7 @@ describe('CloudWatchDatasource', () => {
...
@@ -134,7 +134,7 @@ describe('CloudWatchDatasource', () => {
dimensions
:
{
dimensions
:
{
InstanceId
:
'i-12345678'
,
InstanceId
:
'i-12345678'
,
},
},
statistics
:
[
'pNN.NN'
],
statistics
:
[
stat
],
period
:
'60s'
,
period
:
'60s'
,
},
},
],
],
...
...
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