def run(self, service_id, **kwargs):
log = self.get_logger(**kwargs)<EOL>log.info("<STR_LIT>")<EOL>try:<EOL><INDENT>service = Service.objects.get(id=service_id)<EOL>log.info("<STR_LIT>" % (service.name))<EOL>metrics = self.get_metrics(service.url, service.token)<EOL>result = metrics.json()<EOL>if "<STR_LIT>" in result:<EOL><INDENT>for key in result["<STR_LIT>"]:<EOL><INDENT>check = WidgetData.objects.filter(service=service, key=key)<EOL>if not check.exists():<EOL><INDENT>WidgetData.objects.create(<EOL>service=service,<EOL>key=key,<EOL>title="<STR_LIT>"<EOL>)<EOL>log.info("<STR_LIT>" % (key,))<EOL><DEDENT><DEDENT><DEDENT>return "<STR_LIT>" % (service.name)<EOL><DEDENT>except ObjectDoesNotExist:<EOL><INDENT>logger.error('<STR_LIT>', exc_info=True)<EOL><DEDENT>except SoftTimeLimitExceeded:<EOL><INDENT>logger.error(<EOL>'<STR_LIT>',<EOL>exc_info=True)<EOL><DEDENT>
Retrieve a list of metrics. Ensure they are set as metric data sources.