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
d98d8a40
Commit
d98d8a40
authored
Sep 26, 2017
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix dimension convertion
parent
c140d7aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
20 deletions
+11
-20
pkg/tsdb/cloudwatch/metric_find_query.go
+5
-5
public/app/plugins/datasource/cloudwatch/datasource.js
+6
-15
No files found.
pkg/tsdb/cloudwatch/metric_find_query.go
View file @
d98d8a40
...
...
@@ -335,14 +335,14 @@ func (e *CloudWatchExecutor) handleGetDimensionValues(ctx context.Context, param
namespace
:=
parameters
.
Get
(
"namespace"
)
.
MustString
()
metricName
:=
parameters
.
Get
(
"metricName"
)
.
MustString
()
dimensionKey
:=
parameters
.
Get
(
"dimensionKey"
)
.
MustString
()
dimensionsJson
:=
parameters
.
Get
(
"dimension
Key
"
)
.
MustMap
()
dimensionsJson
:=
parameters
.
Get
(
"dimension
s
"
)
.
MustMap
()
var
dimensions
[]
*
cloudwatch
.
DimensionFilter
for
_
,
d
:=
range
dimensionsJson
{
if
dd
,
ok
:=
d
.
(
map
[
string
]
string
);
ok
{
for
k
,
v
:=
range
dimensionsJson
{
if
vv
,
ok
:=
v
.
(
string
);
ok
{
dimensions
=
append
(
dimensions
,
&
cloudwatch
.
DimensionFilter
{
Name
:
aws
.
String
(
dd
[
"Name"
]
),
Value
:
aws
.
String
(
dd
[
"Value"
]
),
Name
:
aws
.
String
(
k
),
Value
:
aws
.
String
(
vv
),
})
}
}
...
...
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
d98d8a40
...
...
@@ -40,11 +40,7 @@ function (angular, _, moment, dateMath, kbn, templatingVariable) {
item
.
region
=
templateSrv
.
replace
(
item
.
region
,
options
.
scopedVars
);
item
.
namespace
=
templateSrv
.
replace
(
item
.
namespace
,
options
.
scopedVars
);
item
.
metricName
=
templateSrv
.
replace
(
item
.
metricName
,
options
.
scopedVars
);
var
dimensions
=
{};
_
.
each
(
item
.
dimensions
,
function
(
value
,
key
)
{
dimensions
[
templateSrv
.
replace
(
key
,
options
.
scopedVars
)]
=
templateSrv
.
replace
(
value
,
options
.
scopedVars
);
});
item
.
dimensions
=
dimensions
;
item
.
dimensions
=
self
.
convertDimensionFormat
(
item
.
dimensions
,
options
.
scopeVars
);
item
.
period
=
self
.
getPeriod
(
item
,
options
);
return
_
.
extend
({
...
...
@@ -266,16 +262,12 @@ function (angular, _, moment, dateMath, kbn, templatingVariable) {
var
defaultPeriod
=
annotation
.
prefixMatching
?
''
:
'300'
;
var
period
=
annotation
.
period
||
defaultPeriod
;
period
=
parseInt
(
period
,
10
);
var
dimensions
=
{};
_
.
each
(
annotation
.
dimensions
,
function
(
value
,
key
)
{
dimensions
[
templateSrv
.
replace
(
key
,
options
.
scopedVars
)]
=
templateSrv
.
replace
(
value
,
options
.
scopedVars
);
});
var
parameters
=
{
prefixMatching
:
annotation
.
prefixMatching
,
region
:
templateSrv
.
replace
(
annotation
.
region
),
namespace
:
templateSrv
.
replace
(
annotation
.
namespace
),
metricName
:
templateSrv
.
replace
(
annotation
.
metricName
),
dimensions
:
dimensions
,
dimensions
:
this
.
convertDimensionFormat
(
annotation
.
dimensions
,
{})
,
statistics
:
_
.
map
(
annotation
.
statistics
,
function
(
s
)
{
return
templateSrv
.
replace
(
s
);
}),
period
:
period
,
actionPrefix
:
annotation
.
actionPrefix
||
''
,
...
...
@@ -385,12 +377,11 @@ function (angular, _, moment, dateMath, kbn, templatingVariable) {
};
this
.
convertDimensionFormat
=
function
(
dimensions
,
scopedVars
)
{
return
_
.
map
(
dimensions
,
function
(
value
,
key
)
{
return
{
Name
:
templateSrv
.
replace
(
key
,
scopedVars
),
Value
:
templateSrv
.
replace
(
value
,
scopedVars
)
};
var
convertedDimensions
=
{};
_
.
each
(
dimensions
,
function
(
value
,
key
)
{
convertedDimensions
[
templateSrv
.
replace
(
key
,
scopedVars
)]
=
templateSrv
.
replace
(
value
,
scopedVars
);
});
return
convertedDimensions
;
};
}
...
...
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