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
875d80aa
Commit
875d80aa
authored
Oct 02, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cloudwatch): refactoring cloudwatch datasource code, #684
parent
af8d1212
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
21 deletions
+13
-21
public/app/plugins/datasource/cloudwatch/datasource.js
+13
-21
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
875d80aa
...
...
@@ -246,23 +246,20 @@ function (angular, _) {
return
d
.
promise
;
}
var
allQueryPromise
=
_
.
map
(
queries
,
_
.
bind
(
function
(
query
)
{
var
allQueryPromise
=
_
.
map
(
queries
,
function
(
query
)
{
return
this
.
performTimeSeriesQuery
(
query
,
start
,
end
);
},
this
));
return
$q
.
all
(
allQueryPromise
)
.
then
(
function
(
allResponse
)
{
var
result
=
[];
},
this
);
_
.
each
(
allResponse
,
function
(
response
,
index
)
{
var
metrics
=
transformMetricData
(
response
,
options
.
targets
[
index
]);
_
.
each
(
metrics
,
function
(
m
)
{
result
.
push
(
m
);
});
});
return
$q
.
all
(
allQueryPromise
).
then
(
function
(
allResponse
)
{
var
result
=
[];
return
{
data
:
result
};
_
.
each
(
allResponse
,
function
(
response
,
index
)
{
var
metrics
=
transformMetricData
(
response
.
data
,
options
.
targets
[
index
]);
result
=
result
.
concat
(
metrics
);
});
return
{
data
:
result
};
});
};
CloudWatchDatasource
.
prototype
.
performTimeSeriesQuery
=
function
(
query
,
start
,
end
)
{
...
...
@@ -305,23 +302,18 @@ function (angular, _) {
metricName
=
templateSrv
.
replace
(
metricName
);
var
cloudwatch
=
this
.
getAwsClient
(
region
,
'CloudWatch'
);
var
params
=
{
Namespace
:
namespace
,
MetricName
:
metricName
};
var
params
=
{
Namespace
:
namespace
,
MetricName
:
metricName
};
if
(
!
_
.
isEmpty
(
dimensions
))
{
params
.
Dimensions
=
convertDimensionFormat
(
dimensions
);
}
return
cloudwatch
.
listMetrics
(
params
).
then
(
function
(
data
)
{
var
suggestData
=
_
.
chain
(
data
.
Metrics
).
map
(
function
(
metric
)
{
return
cloudwatch
.
listMetrics
(
params
).
then
(
function
(
result
)
{
return
_
.
chain
(
result
.
data
.
Metrics
).
map
(
function
(
metric
)
{
return
metric
.
Dimensions
;
}).
reject
(
function
(
metric
)
{
return
_
.
isEmpty
(
metric
);
}).
value
();
return
suggestData
;
});
};
...
...
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