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
e4de6332
Commit
e4de6332
authored
Sep 20, 2017
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor cloudwatch frontend code
parent
ea704306
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
102 deletions
+18
-102
public/app/plugins/datasource/cloudwatch/datasource.js
+18
-102
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
e4de6332
...
@@ -141,7 +141,7 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
...
@@ -141,7 +141,7 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
});
});
}
}
this
.
getRegions
=
function
(
)
{
this
.
doMetricQueryRequest
=
function
(
subtype
,
parameters
)
{
var
range
=
timeSrv
.
timeRange
();
var
range
=
timeSrv
.
timeRange
();
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
from
:
range
.
from
,
...
@@ -153,142 +153,58 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
...
@@ -153,142 +153,58 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
maxDataPoints
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
type
:
'metricFindQuery'
,
subtype
:
'regions'
subtype
:
subtype
,
parameters
:
parameters
}
}
]
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
getRegions
=
function
()
{
return
this
.
doMetricQueryRequest
(
'regions'
,
null
);
};
this
.
getNamespaces
=
function
()
{
this
.
getNamespaces
=
function
()
{
var
range
=
timeSrv
.
timeRange
();
return
this
.
doMetricQueryRequest
(
'namespaces'
,
null
);
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
to
:
range
.
to
,
queries
:
[
{
refId
:
'metricFindQuery'
,
intervalMs
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
subtype
:
'namespaces'
}
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
getMetrics
=
function
(
namespace
,
region
)
{
this
.
getMetrics
=
function
(
namespace
,
region
)
{
var
range
=
timeSrv
.
timeRange
();
return
this
.
doMetricQueryRequest
(
'metrics'
,
{
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
to
:
range
.
to
,
queries
:
[
{
refId
:
'metricFindQuery'
,
intervalMs
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
subtype
:
'metrics'
,
parameters
:
{
region
:
region
,
region
:
region
,
namespace
:
templateSrv
.
replace
(
namespace
)
namespace
:
templateSrv
.
replace
(
namespace
)
}
});
}
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
getDimensionKeys
=
function
(
namespace
,
region
)
{
this
.
getDimensionKeys
=
function
(
namespace
,
region
)
{
var
range
=
timeSrv
.
timeRange
();
return
this
.
doMetricQueryRequest
(
'dimension_keys'
,
{
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
to
:
range
.
to
,
queries
:
[
{
refId
:
'metricFindQuery'
,
intervalMs
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
subtype
:
'dimension_keys'
,
parameters
:
{
region
:
region
,
region
:
region
,
namespace
:
templateSrv
.
replace
(
namespace
)
namespace
:
templateSrv
.
replace
(
namespace
)
}
});
}
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
getDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensionKey
,
filterDimensions
)
{
this
.
getDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensionKey
,
filterDimensions
)
{
var
range
=
timeSrv
.
timeRange
();
return
this
.
doMetricQueryRequest
(
'dimension_values'
,
{
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
to
:
range
.
to
,
queries
:
[
{
refId
:
'metricFindQuery'
,
intervalMs
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
subtype
:
'dimension_values'
,
parameters
:
{
region
:
region
,
region
:
region
,
namespace
:
templateSrv
.
replace
(
namespace
),
namespace
:
templateSrv
.
replace
(
namespace
),
metricName
:
templateSrv
.
replace
(
metricName
),
metricName
:
templateSrv
.
replace
(
metricName
),
dimensionKey
:
templateSrv
.
replace
(
dimensionKey
),
dimensionKey
:
templateSrv
.
replace
(
dimensionKey
),
dimensions
:
this
.
convertDimensionFormat
(
filterDimensions
,
{}),
dimensions
:
this
.
convertDimensionFormat
(
filterDimensions
,
{}),
}
});
}
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
getEbsVolumeIds
=
function
(
region
,
instanceId
)
{
this
.
getEbsVolumeIds
=
function
(
region
,
instanceId
)
{
var
range
=
timeSrv
.
timeRange
();
return
this
.
doMetricQueryRequest
(
'ebs_volume_ids'
,
{
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
to
:
range
.
to
,
queries
:
[
{
refId
:
'metricFindQuery'
,
intervalMs
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
subtype
:
'ebs_volume_ids'
,
parameters
:
{
region
:
region
,
region
:
region
,
instanceId
:
instanceId
instanceId
:
instanceId
}
});
}
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
getEc2InstanceAttribute
=
function
(
region
,
attributeName
,
filters
)
{
this
.
getEc2InstanceAttribute
=
function
(
region
,
attributeName
,
filters
)
{
var
range
=
timeSrv
.
timeRange
();
return
this
.
doMetricQueryRequest
(
'ec2_instance_attribute'
,
{
return
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
range
.
from
,
to
:
range
.
to
,
queries
:
[
{
refId
:
'metricFindQuery'
,
intervalMs
:
1
,
// dummy
maxDataPoints
:
1
,
// dummy
datasourceId
:
this
.
instanceSettings
.
id
,
type
:
'metricFindQuery'
,
subtype
:
'ec2_instance_attribute'
,
parameters
:
{
region
:
region
,
region
:
region
,
attributeName
:
attributeName
,
attributeName
:
attributeName
,
filters
:
filters
filters
:
filters
}
});
}
]
}).
then
(
function
(
r
)
{
return
transformSuggestDataFromTable
(
r
);
});
};
};
this
.
metricFindQuery
=
function
(
query
)
{
this
.
metricFindQuery
=
function
(
query
)
{
...
...
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