@@ -5,7 +5,7 @@ use std::time::{Duration, Instant};
55
66use analyzeme:: ProfilingData ;
77use bytes:: Buf ;
8- use database:: ArtifactIdNumber ;
8+ use database:: { ArtifactIdNumber , Scenario } ;
99use headers:: { ContentType , Header } ;
1010use hyper:: StatusCode ;
1111
@@ -380,8 +380,14 @@ async fn get_self_profile_raw_data(url: &str) -> Result<Vec<u8>, Response> {
380380 } ;
381381
382382 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+ ) ;
385391 * resp. status_mut ( ) = StatusCode :: INTERNAL_SERVER_ERROR ;
386392 return Err ( resp) ;
387393 }
@@ -594,12 +600,13 @@ pub async fn fetch_raw_self_profile_data(
594600 aid : ArtifactIdNumber ,
595601 benchmark : & str ,
596602 profile : & str ,
597- scenario : & str ,
603+ scenario : Scenario ,
598604 cid : i32 ,
599605) -> Result < Vec < u8 > , Response > {
600- let url = format ! (
606+ let url =
607+ format ! (
601608 "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,
603610 ) ;
604611
605612 get_self_profile_raw_data ( & url) . await
@@ -613,6 +620,10 @@ pub async fn handle_self_profile(
613620 let mut it = body. benchmark . rsplitn ( 2 , '-' ) ;
614621 let profile = it. next ( ) . ok_or ( format ! ( "no benchmark type" ) ) ?;
615622 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) ) ?;
616627 let index = ctxt. index . load ( ) ;
617628
618629 let sort_idx = body
@@ -695,8 +706,7 @@ pub async fn handle_self_profile(
695706 . list_self_profile ( commit. clone ( ) , bench_name, profile, & body. run_name )
696707 . await ;
697708 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 {
700710 Ok ( d) => self_profile_data. push (
701711 extract_profiling_data ( d)
702712 . map_err ( |e| format ! ( "error extracting self profiling data: {}" , e) ) ?,
0 commit comments