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
4b34ff5b
Commit
4b34ff5b
authored
Sep 20, 2017
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor cloudwatch frontend code
parent
e4de6332
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
public/app/plugins/datasource/cloudwatch/datasource.js
+21
-17
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
4b34ff5b
...
...
@@ -170,21 +170,21 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
this
.
getMetrics
=
function
(
namespace
,
region
)
{
return
this
.
doMetricQueryRequest
(
'metrics'
,
{
region
:
region
,
region
:
templateSrv
.
replace
(
region
)
,
namespace
:
templateSrv
.
replace
(
namespace
)
});
};
this
.
getDimensionKeys
=
function
(
namespace
,
region
)
{
return
this
.
doMetricQueryRequest
(
'dimension_keys'
,
{
region
:
region
,
region
:
templateSrv
.
replace
(
region
)
,
namespace
:
templateSrv
.
replace
(
namespace
)
});
};
this
.
getDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensionKey
,
filterDimensions
)
{
return
this
.
doMetricQueryRequest
(
'dimension_values'
,
{
region
:
region
,
region
:
templateSrv
.
replace
(
region
)
,
namespace
:
templateSrv
.
replace
(
namespace
),
metricName
:
templateSrv
.
replace
(
metricName
),
dimensionKey
:
templateSrv
.
replace
(
dimensionKey
),
...
...
@@ -194,15 +194,15 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
this
.
getEbsVolumeIds
=
function
(
region
,
instanceId
)
{
return
this
.
doMetricQueryRequest
(
'ebs_volume_ids'
,
{
region
:
region
,
instanceId
:
instanceId
region
:
templateSrv
.
replace
(
region
)
,
instanceId
:
templateSrv
.
replace
(
instanceId
)
});
};
this
.
getEc2InstanceAttribute
=
function
(
region
,
attributeName
,
filters
)
{
return
this
.
doMetricQueryRequest
(
'ec2_instance_attribute'
,
{
region
:
region
,
attributeName
:
attributeName
,
region
:
templateSrv
.
replace
(
region
)
,
attributeName
:
templateSrv
.
replace
(
attributeName
)
,
filters
:
filters
});
};
...
...
@@ -224,35 +224,39 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
var
metricNameQuery
=
query
.
match
(
/^metrics
\(([^\)]
+
?)(
,
\s?([^
,
]
+
?))?\)
/
);
if
(
metricNameQuery
)
{
return
this
.
getMetrics
(
templateSrv
.
replace
(
metricNameQuery
[
1
]),
templateSrv
.
replace
(
metricNameQuery
[
3
]));
namespace
=
metricNameQuery
[
1
];
region
=
metricNameQuery
[
3
];
return
this
.
getMetrics
(
namespace
,
region
);
}
var
dimensionKeysQuery
=
query
.
match
(
/^dimension_keys
\(([^\)]
+
?)(
,
\s?([^
,
]
+
?))?\)
/
);
if
(
dimensionKeysQuery
)
{
return
this
.
getDimensionKeys
(
templateSrv
.
replace
(
dimensionKeysQuery
[
1
]),
templateSrv
.
replace
(
dimensionKeysQuery
[
3
]));
namespace
=
dimensionKeysQuery
[
1
];
region
=
dimensionKeysQuery
[
3
];
return
this
.
getDimensionKeys
(
namespace
,
region
);
}
var
dimensionValuesQuery
=
query
.
match
(
/^dimension_values
\(([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\s?([^
,
]
+
?)\)
/
);
if
(
dimensionValuesQuery
)
{
region
=
templateSrv
.
replace
(
dimensionValuesQuery
[
1
])
;
namespace
=
templateSrv
.
replace
(
dimensionValuesQuery
[
2
])
;
metricName
=
templateSrv
.
replace
(
dimensionValuesQuery
[
3
])
;
var
dimensionKey
=
templateSrv
.
replace
(
dimensionValuesQuery
[
4
])
;
region
=
dimensionValuesQuery
[
1
]
;
namespace
=
dimensionValuesQuery
[
2
]
;
metricName
=
dimensionValuesQuery
[
3
]
;
var
dimensionKey
=
dimensionValuesQuery
[
4
]
;
return
this
.
getDimensionValues
(
region
,
namespace
,
metricName
,
dimensionKey
,
{});
}
var
ebsVolumeIdsQuery
=
query
.
match
(
/^ebs_volume_ids
\(([^
,
]
+
?)
,
\s?([^
,
]
+
?)\)
/
);
if
(
ebsVolumeIdsQuery
)
{
region
=
templateSrv
.
replace
(
ebsVolumeIdsQuery
[
1
])
;
var
instanceId
=
templateSrv
.
replace
(
ebsVolumeIdsQuery
[
2
])
;
region
=
ebsVolumeIdsQuery
[
1
]
;
var
instanceId
=
ebsVolumeIdsQuery
[
2
]
;
return
this
.
getEbsVolumeIds
(
region
,
instanceId
);
}
var
ec2InstanceAttributeQuery
=
query
.
match
(
/^ec2_instance_attribute
\(([^
,
]
+
?)
,
\s?([^
,
]
+
?)
,
\s?(
.+
?)\)
/
);
if
(
ec2InstanceAttributeQuery
)
{
region
=
templateSrv
.
replace
(
ec2InstanceAttributeQuery
[
1
])
;
var
targetAttributeName
=
templateSrv
.
replace
(
ec2InstanceAttributeQuery
[
2
])
;
region
=
ec2InstanceAttributeQuery
[
1
]
;
var
targetAttributeName
=
ec2InstanceAttributeQuery
[
2
]
;
var
filterJson
=
JSON
.
parse
(
templateSrv
.
replace
(
ec2InstanceAttributeQuery
[
3
]));
return
this
.
getEc2InstanceAttribute
(
region
,
targetAttributeName
,
filterJson
);
}
...
...
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