@@ -5,7 +5,7 @@ use std::time::{Duration, Instant};
5
5
6
6
use analyzeme:: ProfilingData ;
7
7
use bytes:: Buf ;
8
- use database:: ArtifactIdNumber ;
8
+ use database:: { ArtifactIdNumber , Scenario } ;
9
9
use headers:: { ContentType , Header } ;
10
10
use hyper:: StatusCode ;
11
11
@@ -380,8 +380,14 @@ async fn get_self_profile_raw_data(url: &str) -> Result<Vec<u8>, Response> {
380
380
} ;
381
381
382
382
if !resp. status ( ) . is_success ( ) {
383
- let mut resp =
384
- Response :: new ( format ! ( "upstream status {:?} is not successful" , resp. status( ) ) . into ( ) ) ;
383
+ let mut resp = Response :: new (
384
+ format ! (
385
+ "upstream status {:?} is not successful.\n url={}" ,
386
+ resp. status( ) ,
387
+ url
388
+ )
389
+ . into ( ) ,
390
+ ) ;
385
391
* resp. status_mut ( ) = StatusCode :: INTERNAL_SERVER_ERROR ;
386
392
return Err ( resp) ;
387
393
}
@@ -594,12 +600,13 @@ pub async fn fetch_raw_self_profile_data(
594
600
aid : ArtifactIdNumber ,
595
601
benchmark : & str ,
596
602
profile : & str ,
597
- scenario : & str ,
603
+ scenario : Scenario ,
598
604
cid : i32 ,
599
605
) -> Result < Vec < u8 > , Response > {
600
- let url = format ! (
606
+ let url =
607
+ format ! (
601
608
"https://perf-data.rust-lang.org/self-profile/{}/{}/{}/{}/self-profile-{}.mm_profdata.sz" ,
602
- aid. 0 , benchmark, profile, scenario, cid,
609
+ aid. 0 , benchmark, profile, scenario. to_id ( ) , cid,
603
610
) ;
604
611
605
612
get_self_profile_raw_data ( & url) . await
@@ -613,6 +620,10 @@ pub async fn handle_self_profile(
613
620
let mut it = body. benchmark . rsplitn ( 2 , '-' ) ;
614
621
let profile = it. next ( ) . ok_or ( format ! ( "no benchmark type" ) ) ?;
615
622
let bench_name = it. next ( ) . ok_or ( format ! ( "no benchmark name" ) ) ?;
623
+ let scenario = body
624
+ . run_name
625
+ . parse :: < database:: Scenario > ( )
626
+ . map_err ( |e| format ! ( "invalid run name: {:?}" , e) ) ?;
616
627
let index = ctxt. index . load ( ) ;
617
628
618
629
let sort_idx = body
@@ -695,8 +706,7 @@ pub async fn handle_self_profile(
695
706
. list_self_profile ( commit. clone ( ) , bench_name, profile, & body. run_name )
696
707
. await ;
697
708
if let Some ( ( aid, cid) ) = aids_and_cids. first ( ) {
698
- match fetch_raw_self_profile_data ( * aid, bench_name, profile, & body. run_name , * cid) . await
699
- {
709
+ match fetch_raw_self_profile_data ( * aid, bench_name, profile, scenario, * cid) . await {
700
710
Ok ( d) => self_profile_data. push (
701
711
extract_profiling_data ( d)
702
712
. map_err ( |e| format ! ( "error extracting self profiling data: {}" , e) ) ?,
0 commit comments