@@ -231,77 +231,68 @@ def common_exporter_logic(
231231 testcase_metric_context_paths = []
232232 version_target_tables = None
233233 branch_target_tables = None
234+ used_ts = datapoints_timestamp
234235
235- if exporter_timemetric_path is not None and len (metrics ) > 0 :
236- if datapoints_timestamp is None :
237- # extract timestamp
238- datapoints_timestamp = parse_exporter_timemetric (
239- exporter_timemetric_path , results_dict
240- )
241- if datapoints_timestamp is None :
242- datapoints_timestamp = int (
243- datetime .datetime .now (datetime .timezone .utc ).timestamp () * 1000.0
244- )
245- logging .warning (
246- "Error while trying to parse datapoints timestamp. Using current system timestamp Error: {}" .format (
247- datapoints_timestamp
248- )
249- )
250- if (
251- artifact_version is not None
252- and artifact_version != ""
253- and artifact_version != "N/A"
254- ):
255- # extract per-version datapoints
256- (
257- _ ,
258- per_version_time_series_dict ,
259- version_target_tables ,
260- ) = extract_perversion_timeseries_from_results (
261- datapoints_timestamp ,
262- metrics ,
263- results_dict ,
264- artifact_version ,
265- tf_github_org ,
266- tf_github_repo ,
267- deployment_name ,
268- deployment_type ,
269- test_name ,
270- tf_triggering_env ,
271- metadata_tags ,
272- build_variant_name ,
273- running_platform ,
274- testcase_metric_context_paths ,
275- )
276- if tf_github_branch is not None and tf_github_branch != "" :
277- # extract per branch datapoints
278- (
279- _ ,
280- per_branch_time_series_dict ,
281- branch_target_tables ,
282- ) = extract_perbranch_timeseries_from_results (
283- datapoints_timestamp ,
284- metrics ,
285- results_dict ,
286- str (tf_github_branch ),
287- tf_github_org ,
288- tf_github_repo ,
289- deployment_name ,
290- deployment_type ,
291- test_name ,
292- tf_triggering_env ,
293- metadata_tags ,
294- build_variant_name ,
295- running_platform ,
296- testcase_metric_context_paths ,
297- )
298- else :
299- logging .warning (
300- "Requested to push data to RedisTimeSeries but no git"
301- " branch definition was found. git branch value {}" .format (
302- tf_github_branch
303- )
236+ if exporter_timemetric_path is not None and used_ts is None :
237+ # extract timestamp
238+ used_ts = parse_exporter_timemetric (exporter_timemetric_path , results_dict )
239+
240+ if used_ts is None :
241+ used_ts = int (datetime .datetime .now (datetime .timezone .utc ).timestamp () * 1000.0 )
242+ logging .warning (
243+ "Error while trying to parse datapoints timestamp. Using current system timestamp Error: {}" .format (
244+ used_ts
304245 )
246+ )
247+ assert used_ts != None
248+ if (
249+ artifact_version is not None
250+ and artifact_version != ""
251+ and artifact_version != "N/A"
252+ ):
253+ # extract per-version datapoints
254+ (
255+ _ ,
256+ per_version_time_series_dict ,
257+ version_target_tables ,
258+ ) = extract_perversion_timeseries_from_results (
259+ used_ts ,
260+ metrics ,
261+ results_dict ,
262+ artifact_version ,
263+ tf_github_org ,
264+ tf_github_repo ,
265+ deployment_name ,
266+ deployment_type ,
267+ test_name ,
268+ tf_triggering_env ,
269+ metadata_tags ,
270+ build_variant_name ,
271+ running_platform ,
272+ testcase_metric_context_paths ,
273+ )
274+ if tf_github_branch is not None and tf_github_branch != "" :
275+ # extract per branch datapoints
276+ (
277+ _ ,
278+ per_branch_time_series_dict ,
279+ branch_target_tables ,
280+ ) = extract_perbranch_timeseries_from_results (
281+ used_ts ,
282+ metrics ,
283+ results_dict ,
284+ str (tf_github_branch ),
285+ tf_github_org ,
286+ tf_github_repo ,
287+ deployment_name ,
288+ deployment_type ,
289+ test_name ,
290+ tf_triggering_env ,
291+ metadata_tags ,
292+ build_variant_name ,
293+ running_platform ,
294+ testcase_metric_context_paths ,
295+ )
305296 else :
306297 logging .error (
307298 "Requested to push data to RedisTimeSeries but "
0 commit comments