@@ -510,76 +510,25 @@ def run_remote_command_logic(args, project_name, project_version):
510510 )
511511 )
512512
513- (
514- end_time_ms ,
515- _ ,
516- overall_end_time_metrics ,
517- ) = collect_redis_metrics (redis_conns )
518-
519- sprefix = "ci.benchmarks.redislabs/" + "{triggering_env}/{github_org}/{github_repo}" .format (
520- triggering_env = tf_triggering_env ,
521- github_org = tf_github_org ,
522- github_repo = tf_github_repo ,
523- )
524- logging .info (
525- "Adding a total of {} server side metrics collected at the end of benchmark" .format (
526- len (list (overall_end_time_metrics .items ()))
527- )
528- )
529- timeseries_dict = {}
530- by_variants = {}
531- if tf_github_branch is not None :
532- by_variants [
533- "by.branch/{}" .format (tf_github_branch )
534- ] = {"branch" : tf_github_branch }
535- if artifact_version is not None :
536- by_variants [
537- "by.version/{}" .format (artifact_version )
538- ] = {"version" : artifact_version }
539- for (
540- by_variant ,
541- variant_labels_dict ,
542- ) in by_variants .items ():
543- for (
544- metric_name ,
545- metric_value ,
546- ) in overall_end_time_metrics .items ():
547- tsname_metric = (
548- "{}/{}/{}/benchmark_end/{}" .format (
549- sprefix ,
550- test_name ,
551- by_variant ,
552- metric_name ,
553- )
554- )
555-
556- logging .debug (
557- "Adding a redis server side metric collected at the end of benchmark."
558- + " metric_name={} metric_value={} time-series name: {}" .format (
559- metric_name ,
560- metric_value ,
561- tsname_metric ,
562- )
563- )
564- variant_labels_dict ["test_name" ] = test_name
565- variant_labels_dict ["metric" ] = metric_name
566-
567- timeseries_dict [tsname_metric ] = {
568- "labels" : get_project_ts_tags (
569- tf_github_org ,
570- tf_github_repo ,
571- setup_name ,
572- setup_type ,
573- tf_triggering_env ,
574- variant_labels_dict ,
575- None ,
576- None ,
577- ),
578- "data" : {end_time_ms : metric_value },
579- }
580513 if args .push_results_redistimeseries :
581- push_data_to_redistimeseries (
582- rts , timeseries_dict
514+ (
515+ end_time_ms ,
516+ _ ,
517+ overall_end_time_metrics ,
518+ ) = collect_redis_metrics (redis_conns )
519+ export_redis_metrics (
520+ args ,
521+ artifact_version ,
522+ end_time_ms ,
523+ overall_end_time_metrics ,
524+ rts ,
525+ setup_name ,
526+ setup_type ,
527+ test_name ,
528+ tf_github_branch ,
529+ tf_github_org ,
530+ tf_github_repo ,
531+ tf_triggering_env ,
583532 )
584533
585534 if setup_details ["env" ] is None :
@@ -787,6 +736,89 @@ def run_remote_command_logic(args, project_name, project_version):
787736 exit (return_code )
788737
789738
739+ def export_redis_metrics (
740+ artifact_version ,
741+ end_time_ms ,
742+ overall_end_time_metrics ,
743+ rts ,
744+ setup_name ,
745+ setup_type ,
746+ test_name ,
747+ tf_github_branch ,
748+ tf_github_org ,
749+ tf_github_repo ,
750+ tf_triggering_env ,
751+ ):
752+ datapoint_errors = 0
753+ datapoint_inserts = 0
754+ sprefix = (
755+ "ci.benchmarks.redislabs/"
756+ + "{triggering_env}/{github_org}/{github_repo}" .format (
757+ triggering_env = tf_triggering_env ,
758+ github_org = tf_github_org ,
759+ github_repo = tf_github_repo ,
760+ )
761+ )
762+ logging .info (
763+ "Adding a total of {} server side metrics collected at the end of benchmark" .format (
764+ len (list (overall_end_time_metrics .items ()))
765+ )
766+ )
767+ timeseries_dict = {}
768+ by_variants = {}
769+ if tf_github_branch is not None and tf_github_branch != "" :
770+ by_variants ["by.branch/{}" .format (tf_github_branch )] = {
771+ "branch" : tf_github_branch
772+ }
773+ if artifact_version is not None and artifact_version != "" :
774+ by_variants ["by.version/{}" .format (artifact_version )] = {
775+ "version" : artifact_version
776+ }
777+ for (
778+ by_variant ,
779+ variant_labels_dict ,
780+ ) in by_variants .items ():
781+ for (
782+ metric_name ,
783+ metric_value ,
784+ ) in overall_end_time_metrics .items ():
785+ tsname_metric = "{}/{}/{}/benchmark_end/{}" .format (
786+ sprefix ,
787+ test_name ,
788+ by_variant ,
789+ metric_name ,
790+ )
791+
792+ logging .debug (
793+ "Adding a redis server side metric collected at the end of benchmark."
794+ + " metric_name={} metric_value={} time-series name: {}" .format (
795+ metric_name ,
796+ metric_value ,
797+ tsname_metric ,
798+ )
799+ )
800+ variant_labels_dict ["test_name" ] = test_name
801+ variant_labels_dict ["metric" ] = metric_name
802+
803+ timeseries_dict [tsname_metric ] = {
804+ "labels" : get_project_ts_tags (
805+ tf_github_org ,
806+ tf_github_repo ,
807+ setup_name ,
808+ setup_type ,
809+ tf_triggering_env ,
810+ variant_labels_dict ,
811+ None ,
812+ None ,
813+ ),
814+ "data" : {end_time_ms : metric_value },
815+ }
816+ i_errors , i_inserts = push_data_to_redistimeseries (rts , timeseries_dict )
817+ datapoint_errors = datapoint_errors + i_errors
818+ datapoint_inserts = datapoint_inserts + i_inserts
819+ return datapoint_errors , datapoint_inserts
820+
821+
790822def shutdown_remote_redis (redis_conns , ssh_tunnel ):
791823 logging .info ("Shutting down remote redis." )
792824 for conn in redis_conns :
0 commit comments