diff --git a/emission/storage/timeseries/builtin_timeseries.py b/emission/storage/timeseries/builtin_timeseries.py index 64898dcef..e0f3af947 100644 --- a/emission/storage/timeseries/builtin_timeseries.py +++ b/emission/storage/timeseries/builtin_timeseries.py @@ -440,3 +440,15 @@ def update_data(user_id, key, obj_id, data): logging.debug("updating entry %s into timeseries" % new_entry) edb.save(ts.get_timeseries_db(key), new_entry) + def count_data(self, key, extra_query_list): + """ + Returns the total number of documents for the specific key referring to a timeseries db. + Additional keys can be passed as an optional list for filtering data. + """ + logging.debug("count_data timeseries called") + created_query = self._get_query([key], extra_query_list) + result_dataset = self.get_timeseries_db(key) + total_entries = result_set.count_documents(created_query) + return total_entries + +