File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import logging
4+ from datetime import datetime
45from io import BytesIO
56from typing import Any
67
@@ -53,6 +54,7 @@ def compare_preprod_artifact_size_analysis(
5354 project_id : int ,
5455 org_id : int ,
5556 artifact_id : int ,
57+ triggered_at : str | None = None ,
5658 ** kwargs : Any ,
5759) -> None :
5860 logger .info (
@@ -266,7 +268,11 @@ def compare_preprod_artifact_size_analysis(
266268 except (ValueError , AttributeError , TypeError ):
267269 artifact_type_name = "unknown"
268270
269- e2e_size_analysis_compare_duration = timezone .now () - artifact .date_added
271+ # TODO: Remove artifact.date_added fallback once all producers pass triggered_at
272+ start_time = (
273+ datetime .fromisoformat (triggered_at ) if triggered_at else artifact .date_added
274+ )
275+ e2e_size_analysis_compare_duration = timezone .now () - start_time
270276 metrics .distribution (
271277 "preprod.size_analysis.compare.results_e2e" ,
272278 e2e_size_analysis_compare_duration .total_seconds (),
Original file line number Diff line number Diff line change @@ -679,6 +679,7 @@ def _assemble_preprod_artifact_size_analysis(
679679 "project_id" : project .id ,
680680 "org_id" : org_id ,
681681 "artifact_id" : artifact_id ,
682+ "triggered_at" : timezone .now ().isoformat (),
682683 }
683684 )
684685
You can’t perform that action at this time.
0 commit comments