Merge "support fill option"
This commit is contained in:
commit
3615beca8f
|
@ -293,6 +293,23 @@ class MetricClientTest(base.ClientTestBase):
|
|||
'timestamp': '2015-03-06T14:34:12+00:00',
|
||||
'value': '12.0'}], measures)
|
||||
|
||||
# MEASURES AGGREGATION WITH FILL
|
||||
result = self.gnocchi(
|
||||
'measures', params=("aggregation "
|
||||
"--query \"id='metric-res'\" "
|
||||
"--resource-type \"generic\" "
|
||||
"-m metric-name --fill 0 "
|
||||
"--granularity 1 "
|
||||
"--start 2015-03-06T14:32:00 "
|
||||
"--stop 2015-03-06T14:36:00"))
|
||||
measures = self.parser.listing(result)
|
||||
self.assertEqual([{'granularity': '1.0',
|
||||
'timestamp': '2015-03-06T14:33:57+00:00',
|
||||
'value': '43.11'},
|
||||
{'granularity': '1.0',
|
||||
'timestamp': '2015-03-06T14:34:12+00:00',
|
||||
'value': '12.0'}], measures)
|
||||
|
||||
# MEASURES AGGREGATION RESAMPLE
|
||||
result = self.gnocchi(
|
||||
'measures', params=("aggregation "
|
||||
|
|
|
@ -213,7 +213,7 @@ class MetricManager(base.Manager):
|
|||
start=None, stop=None, aggregation=None,
|
||||
reaggregation=None, granularity=None,
|
||||
needed_overlap=None, resource_type="generic",
|
||||
groupby=None, refresh=False, resample=None):
|
||||
groupby=None, refresh=False, resample=None, fill=None):
|
||||
"""Get measurements of an aggregated metrics
|
||||
|
||||
:param metrics: IDs of metric or metric name
|
||||
|
@ -240,6 +240,8 @@ class MetricManager(base.Manager):
|
|||
:type refresh: bool
|
||||
:param resample: resample measures to new granularity
|
||||
:type resample: float
|
||||
:param fill: value to use when backfilling missing datapoints
|
||||
:type fill: float or 'null'
|
||||
|
||||
See Gnocchi REST API documentation for the format
|
||||
of *query dictionary*
|
||||
|
@ -254,7 +256,7 @@ class MetricManager(base.Manager):
|
|||
params = dict(start=start, stop=stop, aggregation=aggregation,
|
||||
reaggregation=reaggregation, granularity=granularity,
|
||||
needed_overlap=needed_overlap, groupby=groupby,
|
||||
refresh=refresh, resample=resample)
|
||||
refresh=refresh, resample=resample, fill=fill)
|
||||
if query is None:
|
||||
for metric in metrics:
|
||||
self._ensure_metric_is_uuid(metric)
|
||||
|
|
|
@ -266,6 +266,10 @@ class CliMeasuresAggregation(lister.Lister):
|
|||
parser.add_argument("--resample",
|
||||
help=("granularity to resample time-series to "
|
||||
"(in seconds)"))
|
||||
parser.add_argument("--fill",
|
||||
help=("Value to use when backfilling timestamps "
|
||||
"with missing values in a subset of series. "
|
||||
"Value should be a float or 'null'."))
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -286,7 +290,7 @@ class CliMeasuresAggregation(lister.Lister):
|
|||
resource_type=parsed_args.resource_type,
|
||||
groupby=parsed_args.groupby,
|
||||
refresh=parsed_args.refresh,
|
||||
resample=parsed_args.resample
|
||||
resample=parsed_args.resample, fill=parsed_args.fill
|
||||
)
|
||||
if parsed_args.groupby:
|
||||
ms = []
|
||||
|
|
Loading…
Reference in New Issue