diff --git a/gnocchiclient/v1/aggregates.py b/gnocchiclient/v1/aggregates.py index a26ec4e..8f1a2c2 100644 --- a/gnocchiclient/v1/aggregates.py +++ b/gnocchiclient/v1/aggregates.py @@ -24,7 +24,8 @@ class AggregatesManager(base.Manager): def fetch(self, operations, search=None, resource_type='generic', start=None, stop=None, granularity=None, - needed_overlap=None, groupby=None, fill=None, details=False): + needed_overlap=None, groupby=None, fill=None, details=False, + use_history=False): """Get measurements of an aggregated metrics. :param operations: operations @@ -44,6 +45,10 @@ def fetch(self, operations, search=None, :param details: also returns the list of metrics or resources associated to the operations :type details: boolean + :param use_history: indicates if Gnocchi server must include in the + response the tag history for resources. The + default value is `False`. + :type use_history: boolean See Gnocchi REST API documentation for the format of *query dictionary* @@ -66,6 +71,8 @@ def fetch(self, operations, search=None, data["resource_type"] = resource_type params["groupby"] = groupby + params['use_history'] = use_history + aggregates = self._post("v1/aggregates?%s" % ( utils.dict_to_querystring(params)), headers={'Content-Type': "application/json"}, diff --git a/gnocchiclient/v1/aggregates_cli.py b/gnocchiclient/v1/aggregates_cli.py index ab82b4d..28f8459 100644 --- a/gnocchiclient/v1/aggregates_cli.py +++ b/gnocchiclient/v1/aggregates_cli.py @@ -42,7 +42,16 @@ def get_parser(self, prog_name): 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'.")) + "Value should be a float or 'null'.")), + parser.add_argument("--use-history", default=False, + help=("Indicates if Gnocchi server should respond " + "with the resource tags history for the " + "aggregation query. If set to `False`, only " + "the latest tag values will be returned. " + "Otherwise, the measures will be split " + "proportionally if a tag has been changed " + "in the `granularity` requested.") + ) return parser def take_action(self, parsed_args): @@ -55,6 +64,7 @@ def take_action(self, parsed_args): granularity=parsed_args.granularity, needed_overlap=parsed_args.needed_overlap, groupby=parsed_args.groupby, + use_history=parsed_args.use_history ) if parsed_args.search and parsed_args.groupby: