@@ -23,12 +23,10 @@ import ScalarPanel, {
23
23
import TablePanel from "components/metrics/panels/TablePanel" ;
24
24
import TimeSeriesPanel from "components/metrics/panels/TimeSeriesPanel" ;
25
25
import { durationDisplay } from "components/TimeUtils" ;
26
- import { useCHContext } from "components/UseClickhouseProvider" ;
27
26
import dayjs from "dayjs" ;
28
27
import { EChartsOption } from "echarts" ;
29
28
import ReactECharts from "echarts-for-react" ;
30
29
import { fetcher } from "lib/GeneralUtils" ;
31
- import { RocksetParam } from "lib/rockset" ;
32
30
import { useEffect , useState } from "react" ;
33
31
import useSWR from "swr" ;
34
32
@@ -378,39 +376,25 @@ function JobsDuration({
378
376
branchName,
379
377
queryName,
380
378
metricName,
381
- percentileParam ,
379
+ percentile ,
382
380
timeParams,
383
- useClickHouse = false ,
384
381
} : {
385
382
title : string ;
386
383
branchName : string ;
387
384
queryName : string ;
388
385
metricName : string ;
389
- percentileParam : RocksetParam ;
390
- timeParams : RocksetParam [ ] ;
391
- useClickHouse ?: boolean ;
386
+ percentile : number ;
387
+ timeParams : { [ key : string ] : string } ;
392
388
} ) {
393
- const ttsPercentile = percentileParam . value ;
394
-
395
- let metricHeaderName : string = `p${ ttsPercentile * 100 } ` ;
396
- let queryParams : RocksetParam [ ] | { } = useClickHouse
397
- ? {
398
- ...RStoCHTimeParams ( timeParams ) ,
399
- branch : branchName ,
400
- percentile : ttsPercentile ,
401
- }
402
- : [
403
- {
404
- name : "branch" ,
405
- type : "string" ,
406
- value : branchName ,
407
- } ,
408
- percentileParam ,
409
- ...timeParams ,
410
- ] ;
389
+ let metricHeaderName : string = `p${ percentile * 100 } ` ;
390
+ let queryParams = {
391
+ ...timeParams ,
392
+ branch : branchName ,
393
+ percentile : percentile ,
394
+ } ;
411
395
412
396
// -1 is the specical case where we will show the avg instead
413
- if ( ttsPercentile === - 1 ) {
397
+ if ( percentile === - 1 ) {
414
398
metricHeaderName = "avg" ;
415
399
queryName = queryName . replace ( "percentile" , "avg" ) ;
416
400
}
@@ -431,66 +415,30 @@ function JobsDuration({
431
415
432
416
const ROW_HEIGHT = 375 ;
433
417
434
- export function RStoCHTimeParams ( params : RocksetParam [ ] ) {
435
- return {
436
- startTime : params
437
- . find ( ( p ) => p . name === "startTime" )
438
- ?. value . utc ( )
439
- . format ( "YYYY-MM-DDTHH:mm:ss.SSS" ) ,
440
- stopTime : params
441
- . find ( ( p ) => p . name === "stopTime" )
442
- ?. value . utc ( )
443
- . format ( "YYYY-MM-DDTHH:mm:ss.SSS" ) ,
444
- } ;
445
- }
446
-
447
418
export default function Page ( ) {
448
419
const [ startTime , setStartTime ] = useState ( dayjs ( ) . subtract ( 1 , "week" ) ) ;
449
420
const [ stopTime , setStopTime ] = useState ( dayjs ( ) ) ;
450
421
const [ timeRange , setTimeRange ] = useState < number > ( 7 ) ;
451
422
452
- // TODO (huydhn): Clean this up once ClickHouse migration finishes
453
- const { useCH : useClickHouse } = useCHContext ( ) ;
454
-
455
- const timeParams : RocksetParam [ ] = [
456
- {
457
- name : "startTime" ,
458
- type : "string" ,
459
- value : startTime ,
460
- } ,
461
- {
462
- name : "stopTime" ,
463
- type : "string" ,
464
- value : stopTime ,
465
- } ,
466
- ] ;
467
- const timeParamsClickHouse = RStoCHTimeParams ( timeParams ) ;
423
+ const timeParams = {
424
+ startTime : startTime . utc ( ) . format ( "YYYY-MM-DDTHH:mm:ss.SSS" ) ,
425
+ stopTime : stopTime . utc ( ) . format ( "YYYY-MM-DDTHH:mm:ss.SSS" ) ,
426
+ } ;
468
427
469
428
const [ ttsPercentile , setTtsPercentile ] = useState < number > ( 0.5 ) ;
470
429
471
- const percentileParam : RocksetParam = {
472
- name : "percentile" ,
473
- type : "float" ,
474
- value : ttsPercentile ,
475
- } ;
476
-
477
430
// Split the aggregated red % into broken trunk and flaky red %
478
- const queryCollection = "metrics" ;
479
431
const queryName = "master_commit_red_avg" ;
480
432
481
433
// Query both broken trunk and flaky red % in one query to some
482
434
// save CPU usage. This query is quite expensive to run
483
- const url = useClickHouse
484
- ? `/api/clickhouse/${ queryName } ?parameters=${ encodeURIComponent (
485
- JSON . stringify ( {
486
- ...timeParamsClickHouse ,
487
- // TODO (huydhn): Figure out a way to have default parameters for ClickHouse queries
488
- workflowNames : [ "lint" , "pull" , "trunk" ] ,
489
- } )
490
- ) } `
491
- : `/api/query/${ queryCollection } /${ queryName } ?parameters=${ encodeURIComponent (
492
- JSON . stringify ( timeParams )
493
- ) } `;
435
+ const url = `/api/clickhouse/${ queryName } ?parameters=${ encodeURIComponent (
436
+ JSON . stringify ( {
437
+ ...timeParams ,
438
+ // TODO (huydhn): Figure out a way to have default parameters for ClickHouse queries
439
+ workflowNames : [ "lint" , "pull" , "trunk" ] ,
440
+ } )
441
+ ) } `;
494
442
495
443
const { data } = useSWR ( url , fetcher , {
496
444
refreshInterval : 5 * 60 * 1000 , // refresh every 5 minutes
@@ -533,7 +481,7 @@ export default function Page() {
533
481
534
482
< Grid container spacing = { 2 } >
535
483
< Grid item md = { 6 } xs = { 12 } height = { ROW_HEIGHT } >
536
- < MasterCommitRedPanel params = { timeParamsClickHouse } />
484
+ < MasterCommitRedPanel params = { timeParams } />
537
485
</ Grid >
538
486
539
487
< Grid container item lg = { 2 } md = { 3 } xs = { 6 } justifyContent = { "stretch" } >
@@ -571,7 +519,7 @@ export default function Page() {
571
519
metricName = { "metric" }
572
520
valueRenderer = { ( value ) => value . toFixed ( 1 ) + "%" }
573
521
queryParams = { {
574
- ...timeParamsClickHouse ,
522
+ ...timeParams ,
575
523
merge_type : "Failure" ,
576
524
one_bucket : true ,
577
525
granularity : "week" , // Not used but ClickHouse requires it
@@ -584,7 +532,7 @@ export default function Page() {
584
532
metricName = { "metric" }
585
533
valueRenderer = { ( value ) => value . toFixed ( 1 ) + "%" }
586
534
queryParams = { {
587
- ...timeParamsClickHouse ,
535
+ ...timeParams ,
588
536
merge_type : "Impatience" ,
589
537
one_bucket : true ,
590
538
granularity : "week" , // Not used but ClickHouse requires it
@@ -603,10 +551,10 @@ export default function Page() {
603
551
< ScalarPanel
604
552
title = { "Time to Red Signal (p90 TTRS - mins)" }
605
553
queryName = { "ttrs_percentiles" }
606
- metricName = { useClickHouse ? "custom" : "ttrs_mins "}
554
+ metricName = { "custom" }
607
555
valueRenderer = { ( value ) => value }
608
556
queryParams = { {
609
- ...timeParamsClickHouse ,
557
+ ...timeParams ,
610
558
one_bucket : true ,
611
559
percentile_to_get : 0.9 ,
612
560
workflow : "pull" ,
@@ -616,10 +564,10 @@ export default function Page() {
616
564
< ScalarPanel
617
565
title = { "Time to Red Signal (p75 TTRS - mins)" }
618
566
queryName = { "ttrs_percentiles" }
619
- metricName = { useClickHouse ? "custom" : "ttrs_mins "}
567
+ metricName = { "custom" }
620
568
valueRenderer = { ( value ) => value }
621
569
queryParams = { {
622
- ...timeParamsClickHouse ,
570
+ ...timeParams ,
623
571
one_bucket : true ,
624
572
percentile_to_get : 0.75 ,
625
573
workflow : "pull" ,
@@ -642,7 +590,7 @@ export default function Page() {
642
590
valueRenderer = { ( value ) => durationDisplay ( value ) }
643
591
queryParams = { {
644
592
repo : "pytorch" ,
645
- owner : "pytorch" , // Not a parameter for the rockset query
593
+ owner : "pytorch" ,
646
594
head : "refs/heads/main" ,
647
595
} }
648
596
badThreshold = { ( value ) => value > 60 * 60 * 6 } // 6 hours
@@ -726,15 +674,15 @@ export default function Page() {
726
674
queryName = { "reverts" }
727
675
metricName = { "num" }
728
676
valueRenderer = { ( value : string ) => value }
729
- queryParams = { timeParamsClickHouse }
677
+ queryParams = { timeParams }
730
678
badThreshold = { ( value ) => value > 10 }
731
679
/>
732
680
< ScalarPanel
733
681
title = { "# commits" }
734
682
queryName = { "num_commits_master" }
735
683
metricName = { "num" }
736
684
valueRenderer = { ( value ) => value }
737
- queryParams = { timeParamsClickHouse }
685
+ queryParams = { timeParams }
738
686
badThreshold = { ( _ ) => false }
739
687
/>
740
688
</ Stack >
@@ -749,7 +697,7 @@ export default function Page() {
749
697
>
750
698
< WorkflowDuration
751
699
percentile = { ttsPercentile }
752
- timeParams = { timeParamsClickHouse }
700
+ timeParams = { timeParams }
753
701
workflowNames = { [ "pull" , "trunk" ] }
754
702
/>
755
703
</ Stack >
@@ -814,7 +762,7 @@ export default function Page() {
814
762
title = { "Queue times historical" }
815
763
queryName = { "queue_times_historical" }
816
764
queryParams = { {
817
- ...timeParamsClickHouse ,
765
+ ...timeParams ,
818
766
granlarity : "hour" ,
819
767
} }
820
768
granularity = { "hour" }
@@ -829,7 +777,7 @@ export default function Page() {
829
777
< TimeSeriesPanel
830
778
title = { "Workflow load per Day" }
831
779
queryName = { "workflow_load" }
832
- queryParams = { { ...timeParamsClickHouse , repo : "pytorch/pytorch" } }
780
+ queryParams = { { ...timeParams , repo : "pytorch/pytorch" } }
833
781
granularity = { "hour" }
834
782
groupByFieldName = { "name" }
835
783
timeFieldName = { "granularity_bucket" }
@@ -844,46 +792,42 @@ export default function Page() {
844
792
branchName = { "%" }
845
793
queryName = { "tts_percentile" }
846
794
metricName = { "tts_sec" }
847
- percentileParam = { percentileParam }
795
+ percentile = { ttsPercentile }
848
796
timeParams = { timeParams }
849
- useClickHouse = { useClickHouse }
850
797
/>
851
798
852
799
< JobsDuration
853
800
title = { "Job time-to-signal, main-only" }
854
801
branchName = { "main" }
855
802
queryName = { "tts_percentile" }
856
803
metricName = { "tts_sec" }
857
- percentileParam = { percentileParam }
804
+ percentile = { ttsPercentile }
858
805
timeParams = { timeParams }
859
- useClickHouse = { useClickHouse }
860
806
/>
861
807
862
808
< JobsDuration
863
809
title = { "Job duration, all branches" }
864
810
branchName = { "%" }
865
811
queryName = { "job_duration_percentile" }
866
812
metricName = { "duration_sec" }
867
- percentileParam = { percentileParam }
813
+ percentile = { ttsPercentile }
868
814
timeParams = { timeParams }
869
- useClickHouse = { useClickHouse }
870
815
/>
871
816
872
817
< JobsDuration
873
818
title = { "Job duration, main-only" }
874
819
branchName = { "main" }
875
820
queryName = { "job_duration_percentile" }
876
821
metricName = { "duration_sec" }
877
- percentileParam = { percentileParam }
822
+ percentile = { ttsPercentile }
878
823
timeParams = { timeParams }
879
- useClickHouse = { useClickHouse }
880
824
/>
881
825
882
826
< Grid item xs = { 6 } height = { ROW_HEIGHT } >
883
827
< TablePanel
884
828
title = { "Failed Jobs Log Classifications" }
885
829
queryName = { "log_captures_count" }
886
- queryParams = { timeParamsClickHouse }
830
+ queryParams = { timeParams }
887
831
columns = { [
888
832
{ field : "num" , headerName : "Count" , flex : 1 } ,
889
833
{ field : "example" , headerName : "Example" , flex : 4 } ,
@@ -912,7 +856,7 @@ export default function Page() {
912
856
< TimeSeriesPanel
913
857
title = { "Number of new disabled tests" }
914
858
queryName = { "disabled_test_historical" }
915
- queryParams = { { ...timeParamsClickHouse , repo : "pytorch/pytorch" } }
859
+ queryParams = { { ...timeParams , repo : "pytorch/pytorch" } }
916
860
granularity = { "day" }
917
861
timeFieldName = { "granularity_bucket" }
918
862
yAxisFieldName = { "number_of_new_disabled_tests" }
@@ -937,7 +881,7 @@ export default function Page() {
937
881
< TimeSeriesPanel
938
882
title = { "LF vs Meta: Success rate delta" }
939
883
queryName = { "lf_rollover_health" }
940
- queryParams = { { ...timeParamsClickHouse , days_ago : timeRange } }
884
+ queryParams = { { ...timeParams , days_ago : timeRange } }
941
885
granularity = { "day" }
942
886
timeFieldName = { "bucket" }
943
887
yAxisLabel = { "rate delta" }
@@ -951,7 +895,7 @@ export default function Page() {
951
895
< TimeSeriesPanel
952
896
title = { "LF vs Meta: Cancelled rate delta" }
953
897
queryName = { "lf_rollover_health" }
954
- queryParams = { { ...timeParamsClickHouse , days_ago : timeRange } }
898
+ queryParams = { { ...timeParams , days_ago : timeRange } }
955
899
granularity = { "day" }
956
900
timeFieldName = { "bucket" }
957
901
yAxisLabel = { "rate delta" }
@@ -965,7 +909,7 @@ export default function Page() {
965
909
< TimeSeriesPanel
966
910
title = { "LF vs Meta: Duration increase ratio" }
967
911
queryName = { "lf_rollover_health" }
968
- queryParams = { { ...timeParamsClickHouse , days_ago : timeRange } }
912
+ queryParams = { { ...timeParams , days_ago : timeRange } }
969
913
granularity = { "day" }
970
914
timeFieldName = { "bucket" }
971
915
yAxisLabel = "increase ratio"
@@ -978,7 +922,7 @@ export default function Page() {
978
922
< TimeSeriesPanel
979
923
title = { "Percentage of jobs rolled over to Linux Foundation" }
980
924
queryName = { "lf_rollover_percentage" }
981
- queryParams = { { ...timeParamsClickHouse , days_ago : timeRange } }
925
+ queryParams = { { ...timeParams , days_ago : timeRange } }
982
926
granularity = { "hour" }
983
927
timeFieldName = { "bucket" }
984
928
yAxisFieldName = { "percentage" }
0 commit comments