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
c0c8465e
Commit
c0c8465e
authored
Aug 24, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loading custom metrics definitions
parent
e74be588
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletions
+53
-1
public/app/plugins/datasource/cloudwatch/datasource.js
+41
-0
public/app/plugins/datasource/cloudwatch/partials/config.html
+12
-1
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
c0c8465e
...
...
@@ -172,6 +172,47 @@ function (angular, _, kbn) {
],
};
/* jshint +W101 */
/* load custom metrics definitions */
var
self
=
this
;
$q
.
all
(
_
.
map
(
datasource
.
jsonData
.
customMetricsAttributes
,
function
(
u
)
{
return
$http
({
method
:
'GET'
,
url
:
u
});
})
)
.
then
(
function
(
allResponse
)
{
_
.
chain
(
allResponse
)
.
map
(
function
(
d
)
{
return
d
.
data
.
Metrics
;
})
.
flatten
()
.
reject
(
function
(
metric
)
{
return
metric
.
Namespace
.
indexOf
(
'AWS/'
)
===
0
;
})
.
map
(
function
(
metric
)
{
metric
.
Dimensions
=
_
.
chain
(
metric
.
Dimensions
)
.
map
(
function
(
d
)
{
return
d
.
Name
;
})
.
value
().
sort
();
return
metric
;
})
.
uniq
(
function
(
metric
)
{
return
metric
.
Namespace
+
metric
.
MetricName
+
metric
.
Dimensions
.
join
(
''
);
})
.
each
(
function
(
metric
)
{
if
(
!
_
.
has
(
self
.
supportedMetrics
,
metric
.
Namespace
))
{
self
.
supportedMetrics
[
metric
.
Namespace
]
=
[];
}
self
.
supportedMetrics
[
metric
.
Namespace
].
push
(
metric
.
MetricName
);
if
(
!
_
.
has
(
self
.
supportedDimensions
,
metric
.
Namespace
))
{
self
.
supportedDimensions
[
metric
.
Namespace
]
=
[];
}
self
.
supportedDimensions
[
metric
.
Namespace
]
=
_
.
union
(
self
.
supportedDimensions
[
metric
.
Namespace
],
metric
.
Dimensions
);
});
});
}
// Called once per panel (graph)
...
...
public/app/plugins/datasource/cloudwatch/partials/config.html
View file @
c0c8465e
...
...
@@ -19,7 +19,7 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form
last
"
ng-show=
"current.jsonData.access === 'direct'"
>
<div
class=
"tight-form"
ng-show=
"current.jsonData.access === 'direct'"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
Access Key Id
...
...
@@ -37,3 +37,14 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form last"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
Custom Metrics Attributes
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-xlarge"
ng-model=
'current.jsonData.customMetricsAttributes[0]'
ng-init=
"current.jsonData.customMetricsAttributes = current.jsonData.customMetricsAttributes || []"
placeholder=
""
required
></input>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
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