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
deedd166
Commit
deedd166
authored
Aug 11, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add metricFindQuery
parent
6ffab821
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
public/app/plugins/datasource/cloudwatch/datasource.js
+55
-0
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
deedd166
...
...
@@ -315,6 +315,61 @@ function (angular, _, kbn) {
return
d
.
promise
;
};
CloudWatchDatasource
.
prototype
.
metricFindQuery
=
function
(
query
)
{
var
region
;
var
namespace
;
var
metricName
;
var
dimensions
;
var
transformSuggestData
=
function
(
suggestData
)
{
return
_
.
map
(
suggestData
,
function
(
v
)
{
return
{
text
:
v
};
});
};
var
d
=
$q
.
defer
();
var
regionQuery
=
query
.
match
(
/^region
\(\)
/
);
if
(
regionQuery
)
{
d
.
resolve
(
transformSuggestData
(
this
.
performSuggestRegion
()));
return
d
.
promise
;
}
var
namespaceQuery
=
query
.
match
(
/^namespace
\(\)
/
);
if
(
namespaceQuery
)
{
d
.
resolve
(
transformSuggestData
(
this
.
performSuggestNamespace
()));
return
d
.
promise
;
}
var
metricNameQuery
=
query
.
match
(
/^metrics
\(([^\)]
+
?)\)
/
);
if
(
metricNameQuery
)
{
namespace
=
metricNameQuery
[
1
];
d
.
resolve
(
transformSuggestData
(
this
.
performSuggestMetrics
(
namespace
)));
return
d
.
promise
;
}
var
dimensionKeysQuery
=
query
.
match
(
/^dimension_keys
\(([^\)]
+
?)\)
/
);
if
(
dimensionKeysQuery
)
{
namespace
=
dimensionKeysQuery
[
1
];
d
.
resolve
(
transformSuggestData
(
this
.
performSuggestDimensionKeys
(
namespace
)));
return
d
.
promise
;
}
var
dimensionValuesQuery
=
query
.
match
(
/^dimension_values
\(([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\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
);
}
return
$q
.
when
([]);
};
CloudWatchDatasource
.
prototype
.
testDatasource
=
function
()
{
/* use billing metrics for test */
var
region
=
'us-east-1'
;
...
...
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