From 4a6f956c2851920f2f1764ca9e573fd7b22be016 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 13 Jan 2024 23:07:40 +0100 Subject: [PATCH] lint Signed-off-by: Jens Langhammer --- authentik/events/api/tasks.py | 2 ++ authentik/events/models.py | 4 ++-- schema.yml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/authentik/events/api/tasks.py b/authentik/events/api/tasks.py index 99a97aa8d..c89724059 100644 --- a/authentik/events/api/tasks.py +++ b/authentik/events/api/tasks.py @@ -41,9 +41,11 @@ class SystemTaskSerializer(ModelSerializer): return instance.name def get_start_timestamp(self, instance: SystemTask) -> datetime: + """Timestamp when the task started""" return datetime.fromtimestamp(instance.start_timestamp, tz=timezone.utc) def get_finish_timestamp(self, instance: SystemTask) -> datetime: + """Timestamp when the task finished""" return datetime.fromtimestamp(instance.finish_timestamp, tz=timezone.utc) def get_duration(self, instance: SystemTask) -> float: diff --git a/authentik/events/models.py b/authentik/events/models.py index b50db8162..7736bc198 100644 --- a/authentik/events/models.py +++ b/authentik/events/models.py @@ -625,13 +625,13 @@ class SystemTask(SerializerModel, ExpiringModel): duration = max(self.finish_timestamp - self.start_timestamp, 0) # TODO: Deprecated metric - remove in 2024.2 or later GAUGE_TASKS.labels( - task_name=self.name.split(":")[0], + task_name=self.name, task_uid=self.uid or "", status=self.status.lower(), ).set(duration) SYSTEM_TASK_TIME.observe(duration) SYSTEM_TASK_STATUS.labels( - task_name=self.name.split(":")[0], + task_name=self.name, task_uid=self.uid or "", status=self.status.lower(), ).inc() diff --git a/schema.yml b/schema.yml index e12028bdb..fcc7f2d8d 100644 --- a/schema.yml +++ b/schema.yml @@ -42719,10 +42719,12 @@ components: start_timestamp: type: string format: date-time + description: Timestamp when the task started readOnly: true finish_timestamp: type: string format: date-time + description: Timestamp when the task finished readOnly: true duration: type: number