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
3662b03d
Commit
3662b03d
authored
Jan 23, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
dbfaf5da
d82af23f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
+26
-12
pkg/tsdb/cloudwatch/metric_find_query.go
+26
-12
No files found.
pkg/tsdb/cloudwatch/metric_find_query.go
View file @
3662b03d
...
...
@@ -188,18 +188,6 @@ func (e *CloudWatchExecutor) executeMetricFindQuery(ctx context.Context, queryCo
data
,
err
=
e
.
handleGetEbsVolumeIds
(
ctx
,
parameters
,
queryContext
)
break
case
"ec2_instance_attribute"
:
region
:=
parameters
.
Get
(
"region"
)
.
MustString
()
dsInfo
:=
e
.
getDsInfo
(
region
)
cfg
,
err
:=
e
.
getAwsConfig
(
dsInfo
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to call ec2:DescribeInstances, %v"
,
err
)
}
sess
,
err
:=
session
.
NewSession
(
cfg
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to call ec2:DescribeInstances, %v"
,
err
)
}
e
.
ec2Svc
=
ec2
.
New
(
sess
,
cfg
)
data
,
err
=
e
.
handleGetEc2InstanceAttribute
(
ctx
,
parameters
,
queryContext
)
break
}
...
...
@@ -365,10 +353,31 @@ func (e *CloudWatchExecutor) handleGetDimensionValues(ctx context.Context, param
return
result
,
nil
}
func
(
e
*
CloudWatchExecutor
)
ensureClientSession
(
region
string
)
error
{
if
e
.
ec2Svc
==
nil
{
dsInfo
:=
e
.
getDsInfo
(
region
)
cfg
,
err
:=
e
.
getAwsConfig
(
dsInfo
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Failed to call ec2:getAwsConfig, %v"
,
err
)
}
sess
,
err
:=
session
.
NewSession
(
cfg
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Failed to call ec2:NewSession, %v"
,
err
)
}
e
.
ec2Svc
=
ec2
.
New
(
sess
,
cfg
)
}
return
nil
}
func
(
e
*
CloudWatchExecutor
)
handleGetEbsVolumeIds
(
ctx
context
.
Context
,
parameters
*
simplejson
.
Json
,
queryContext
*
tsdb
.
TsdbQuery
)
([]
suggestData
,
error
)
{
region
:=
parameters
.
Get
(
"region"
)
.
MustString
()
instanceId
:=
parameters
.
Get
(
"instanceId"
)
.
MustString
()
err
:=
e
.
ensureClientSession
(
region
)
if
err
!=
nil
{
return
nil
,
err
}
instanceIds
:=
[]
*
string
{
aws
.
String
(
instanceId
)}
instances
,
err
:=
e
.
ec2DescribeInstances
(
region
,
nil
,
instanceIds
)
if
err
!=
nil
{
...
...
@@ -404,6 +413,11 @@ func (e *CloudWatchExecutor) handleGetEc2InstanceAttribute(ctx context.Context,
}
}
err
:=
e
.
ensureClientSession
(
region
)
if
err
!=
nil
{
return
nil
,
err
}
instances
,
err
:=
e
.
ec2DescribeInstances
(
region
,
filters
,
nil
)
if
err
!=
nil
{
return
nil
,
err
...
...
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