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
96ca69c5
Commit
96ca69c5
authored
Oct 03, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(cloudwatch): extract method
parent
6b701579
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
public/app/plugins/datasource/cloudwatch/datasource.js
+24
-15
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
96ca69c5
...
@@ -37,21 +37,9 @@ function (angular, _, moment, dateMath, kbn, CloudWatchAnnotationQuery) {
...
@@ -37,21 +37,9 @@ function (angular, _, moment, dateMath, kbn, CloudWatchAnnotationQuery) {
query
.
dimensions
=
self
.
convertDimensionFormat
(
target
.
dimensions
,
options
.
scopedVars
);
query
.
dimensions
=
self
.
convertDimensionFormat
(
target
.
dimensions
,
options
.
scopedVars
);
query
.
statistics
=
target
.
statistics
;
query
.
statistics
=
target
.
statistics
;
var
range
=
end
-
start
;
var
period
=
this
.
_getPeriod
(
target
,
query
,
options
,
start
,
end
);
if
(
!
target
.
period
)
{
target
.
period
=
period
;
query
.
period
=
(
query
.
namespace
===
'AWS/EC2'
)
?
300
:
60
;
query
.
period
=
period
;
}
else
if
(
/^
\d
+$/
.
test
(
target
.
period
))
{
query
.
period
=
parseInt
(
target
.
period
,
10
);
}
else
{
query
.
period
=
kbn
.
interval_to_seconds
(
templateSrv
.
replace
(
target
.
period
,
options
.
scopedVars
));
}
if
(
query
.
period
<
60
)
{
query
.
period
=
60
;
}
if
(
range
/
query
.
period
>=
1440
)
{
query
.
period
=
Math
.
ceil
(
range
/
1440
/
60
)
*
60
;
}
target
.
period
=
query
.
period
;
queries
.
push
(
query
);
queries
.
push
(
query
);
}.
bind
(
this
));
}.
bind
(
this
));
...
@@ -79,6 +67,27 @@ function (angular, _, moment, dateMath, kbn, CloudWatchAnnotationQuery) {
...
@@ -79,6 +67,27 @@ function (angular, _, moment, dateMath, kbn, CloudWatchAnnotationQuery) {
});
});
};
};
this
.
_getPeriod
=
function
(
target
,
query
,
options
,
start
,
end
)
{
var
period
;
var
range
=
end
-
start
;
if
(
!
target
.
period
)
{
period
=
(
query
.
namespace
===
'AWS/EC2'
)
?
300
:
60
;
}
else
if
(
/^
\d
+$/
.
test
(
target
.
period
))
{
period
=
parseInt
(
target
.
period
,
10
);
}
else
{
period
=
kbn
.
interval_to_seconds
(
templateSrv
.
replace
(
target
.
period
,
options
.
scopedVars
));
}
if
(
query
.
period
<
60
)
{
period
=
60
;
}
if
(
range
/
query
.
period
>=
1440
)
{
period
=
Math
.
ceil
(
range
/
1440
/
60
)
*
60
;
}
return
period
;
};
this
.
performTimeSeriesQuery
=
function
(
query
,
start
,
end
)
{
this
.
performTimeSeriesQuery
=
function
(
query
,
start
,
end
)
{
return
this
.
awsRequest
({
return
this
.
awsRequest
({
region
:
query
.
region
,
region
:
query
.
region
,
...
...
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