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
4f42dae3
Commit
4f42dae3
authored
Aug 11, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change behavior of dimension value suggestion
parent
deedd166
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
22 deletions
+31
-22
public/app/plugins/datasource/cloudwatch/datasource.js
+20
-19
public/app/plugins/datasource/cloudwatch/queryCtrl.js
+11
-3
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
4f42dae3
...
...
@@ -271,7 +271,7 @@ function (angular, _, kbn) {
return
this
.
supportedDimensions
[
namespace
]
||
[];
};
CloudWatchDatasource
.
prototype
.
performSuggestDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensions
,
targetDimensionKey
)
{
CloudWatchDatasource
.
prototype
.
performSuggestDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensions
)
{
var
cloudwatch
=
this
.
getCloudWatchClient
(
region
);
var
params
=
{
...
...
@@ -298,15 +298,6 @@ function (angular, _, kbn) {
.
map
(
function
(
metric
)
{
return
metric
.
Dimensions
;
})
.
flatten
(
true
)
.
filter
(
function
(
dimension
)
{
return
dimension
.
Name
===
targetDimensionKey
;
})
.
map
(
function
(
metric
)
{
return
metric
;
})
.
pluck
(
'Value'
)
.
uniq
()
.
value
();
return
d
.
resolve
(
suggestData
);
...
...
@@ -319,7 +310,6 @@ function (angular, _, kbn) {
var
region
;
var
namespace
;
var
metricName
;
var
dimensions
;
var
transformSuggestData
=
function
(
suggestData
)
{
return
_
.
map
(
suggestData
,
function
(
v
)
{
...
...
@@ -355,16 +345,28 @@ function (angular, _, kbn) {
return
d
.
promise
;
}
var
dimensionValuesQuery
=
query
.
match
(
/^dimension_values
\(([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\s?([^
,
]
+
?)
\)
/
);
var
dimensionValuesQuery
=
query
.
match
(
/^dimension_values
\(([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\s?([^
,
]
+
?)\)
/
);
if
(
dimensionValuesQuery
)
{
region
=
dimensionValuesQuery
[
1
];
namespace
=
dimensionValuesQuery
[
2
];
metricName
=
dimensionValuesQuery
[
3
];
dimensions
=
{};
var
targetDimensionKey
=
dimensionValuesQuery
[
4
];
return
this
.
performSuggestDimensionValues
(
region
,
namespace
,
metricName
,
dimensions
,
targetDimensionKey
)
.
then
(
transformSuggestData
);
var
dimensions
=
{};
return
this
.
performSuggestDimensionValues
(
region
,
namespace
,
metricName
,
dimensions
)
.
then
(
function
(
suggestData
)
{
return
_
.
map
(
suggestData
,
function
(
dimensions
)
{
var
result
=
_
.
chain
(
dimensions
)
.
sortBy
(
function
(
dimension
)
{
return
dimension
.
Name
;
})
.
map
(
function
(
dimension
)
{
return
dimension
.
Name
+
'='
+
dimension
.
Value
;
})
.
value
().
join
(
','
);
return
{
text
:
result
};
});
});
}
return
$q
.
when
([]);
...
...
@@ -376,9 +378,8 @@ function (angular, _, kbn) {
var
namespace
=
'AWS/Billing'
;
var
metricName
=
'EstimatedCharges'
;
var
dimensions
=
{};
var
targetDimensionKey
=
'ServiceName'
;
return
this
.
performSuggestDimensionValues
(
region
,
namespace
,
metricName
,
dimensions
,
targetDimensionKey
).
then
(
function
()
{
return
this
.
performSuggestDimensionValues
(
region
,
namespace
,
metricName
,
dimensions
).
then
(
function
()
{
return
{
status
:
'success'
,
message
:
'Data source is working'
,
title
:
'Success'
};
});
};
...
...
public/app/plugins/datasource/cloudwatch/queryCtrl.js
View file @
4f42dae3
...
...
@@ -64,11 +64,19 @@ function (angular, _) {
$scope
.
target
.
region
,
$scope
.
target
.
namespace
,
$scope
.
target
.
metricName
,
$scope
.
target
.
dimensions
,
$scope
.
target
.
currentDimensionKey
$scope
.
target
.
dimensions
)
.
then
(
function
(
result
)
{
callback
(
result
);
var
suggestData
=
_
.
chain
(
result
)
.
flatten
(
true
)
.
filter
(
function
(
dimension
)
{
return
dimension
.
Name
===
$scope
.
target
.
currentDimensionKey
;
})
.
pluck
(
'Value'
)
.
uniq
()
.
value
();
callback
(
suggestData
);
},
function
()
{
callback
([]);
});
...
...
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