in app/marketplace.py [0:0]
def meter_usages(self, dry_run=False):
""" Iterates over all dimensions on the DynamoDB table and sends it to Marketplace Metering Service (MMS) using the meter_usage method. """
logger.info(f"meter_usages: dry_run={dry_run}")
responses = []
for d in self._dimensions_storage.get_dimensions():
# If you call meter_usage at start time with 0 as quantity,
# you won't be able to send another a different quantity for the first hour.
# Dimensions can only be reported once per hour.
# We are avoiding this problem here
if (dry_run):
responses += [self._meter_usage(dimension=d, dry_run=dry_run)]
else:
if not (self._initializing and d.quantity == 0):
responses += [
self._meter_usage(dimension=d, dry_run=dry_run)
]
if (self._initializing):
logger.info(f"setting _initializing to False")
self._initializing = False
return responses