def on_success(self, retval, task_id, args, kwargs): if settings.METRICS_ENABLED: pretix_task_runs_total.inc(1, task_name=self.name, status="success") return super().on_success(retval, task_id, args, kwargs)
def on_failure(self, exc, task_id, args, kwargs, einfo): if settings.METRICS_ENABLED: expected = False for t in self.throws: if isinstance(exc, t): expected = True break pretix_task_runs_total.inc(1, task_name=self.name, status="expected-error" if expected else "error") return super().on_failure(exc, task_id, args, kwargs, einfo)
def on_failure(self, exc, task_id, args, kwargs, einfo): if settings.METRICS_ENABLED: expected = False for t in self.throws: if isinstance(exc, t): expected = True break pretix_task_runs_total.inc( 1, task_name=self.name, status="expected-error" if expected else "error") return super().on_failure(exc, task_id, args, kwargs, einfo)