11use lazy_static:: lazy_static;
2- use orchestrator:: coordinator;
2+ use orchestrator:: coordinator:: { self , Channel , CompileTarget , CrateType , Edition , Mode } ;
33use prometheus:: {
44 self , register_histogram, register_histogram_vec, register_int_counter,
55 register_int_counter_vec, register_int_gauge, Histogram , HistogramVec , IntCounter ,
@@ -10,7 +10,7 @@ use std::{
1010 time:: { Duration , Instant } ,
1111} ;
1212
13- use crate :: sandbox:: { self , Channel , CompileTarget , CrateType , Edition , Mode } ;
13+ use crate :: sandbox;
1414
1515lazy_static ! {
1616 pub ( crate ) static ref REQUESTS : HistogramVec = register_histogram_vec!(
@@ -132,15 +132,38 @@ impl Labels {
132132 v. map_or ( "" , |v| if v { "true" } else { "false" } )
133133 }
134134
135- let target = target. map_or ( "" , Into :: into) ;
136- let channel = channel. map_or ( "" , Into :: into) ;
137- let mode = mode. map_or ( "" , Into :: into) ;
135+ let target = match target {
136+ Some ( CompileTarget :: Assembly ( _, _, _) ) => "Assembly" ,
137+ Some ( CompileTarget :: Hir ) => "Hir" ,
138+ Some ( CompileTarget :: LlvmIr ) => "LlvmIr" ,
139+ Some ( CompileTarget :: Mir ) => "Mir" ,
140+ Some ( CompileTarget :: Wasm ) => "Wasm" ,
141+ None => "" ,
142+ } ;
143+ let channel = match channel {
144+ Some ( Channel :: Stable ) => "Stable" ,
145+ Some ( Channel :: Beta ) => "Beta" ,
146+ Some ( Channel :: Nightly ) => "Nightly" ,
147+ None => "" ,
148+ } ;
149+ let mode = match mode {
150+ Some ( Mode :: Debug ) => "Debug" ,
151+ Some ( Mode :: Release ) => "Release" ,
152+ None => "" ,
153+ } ;
138154 let edition = match edition {
139155 None => "" ,
140156 Some ( None ) => "Unspecified" ,
141- Some ( Some ( v) ) => v. into ( ) ,
157+ Some ( Some ( Edition :: Rust2015 ) ) => "Rust2015" ,
158+ Some ( Some ( Edition :: Rust2018 ) ) => "Rust2018" ,
159+ Some ( Some ( Edition :: Rust2021 ) ) => "Rust2021" ,
160+ Some ( Some ( Edition :: Rust2024 ) ) => "Rust2024" ,
161+ } ;
162+ let crate_type = match crate_type {
163+ Some ( CrateType :: Binary ) => "Binary" ,
164+ Some ( CrateType :: Library ( _) ) => "Library" ,
165+ None => "" ,
142166 } ;
143- let crate_type = crate_type. map_or ( "" , Into :: into) ;
144167 let tests = b ( tests) ;
145168 let backtrace = b ( backtrace) ;
146169
@@ -262,11 +285,11 @@ impl HasLabelsCore for coordinator::CompileRequest {
262285 } = * self ;
263286
264287 LabelsCore {
265- target : Some ( target. into ( ) ) ,
266- channel : Some ( channel. into ( ) ) ,
267- mode : Some ( mode. into ( ) ) ,
268- edition : Some ( Some ( edition. into ( ) ) ) ,
269- crate_type : Some ( crate_type. into ( ) ) ,
288+ target : Some ( target) ,
289+ channel : Some ( channel) ,
290+ mode : Some ( mode) ,
291+ edition : Some ( Some ( edition) ) ,
292+ crate_type : Some ( crate_type) ,
270293 tests : Some ( tests) ,
271294 backtrace : Some ( backtrace) ,
272295 }
@@ -287,10 +310,10 @@ impl HasLabelsCore for coordinator::ExecuteRequest {
287310
288311 LabelsCore {
289312 target : None ,
290- channel : Some ( channel. into ( ) ) ,
291- mode : Some ( mode. into ( ) ) ,
292- edition : Some ( Some ( edition. into ( ) ) ) ,
293- crate_type : Some ( crate_type. into ( ) ) ,
313+ channel : Some ( channel) ,
314+ mode : Some ( mode) ,
315+ edition : Some ( Some ( edition) ) ,
316+ crate_type : Some ( crate_type) ,
294317 tests : Some ( tests) ,
295318 backtrace : Some ( backtrace) ,
296319 }
@@ -308,10 +331,10 @@ impl HasLabelsCore for coordinator::FormatRequest {
308331
309332 LabelsCore {
310333 target : None ,
311- channel : Some ( channel. into ( ) ) ,
334+ channel : Some ( channel) ,
312335 mode : None ,
313- edition : Some ( Some ( edition. into ( ) ) ) ,
314- crate_type : Some ( crate_type. into ( ) ) ,
336+ edition : Some ( Some ( edition) ) ,
337+ crate_type : Some ( crate_type) ,
315338 tests : None ,
316339 backtrace : None ,
317340 }
@@ -329,10 +352,10 @@ impl HasLabelsCore for coordinator::ClippyRequest {
329352
330353 LabelsCore {
331354 target : None ,
332- channel : Some ( channel. into ( ) ) ,
355+ channel : Some ( channel) ,
333356 mode : None ,
334- edition : Some ( Some ( edition. into ( ) ) ) ,
335- crate_type : Some ( crate_type. into ( ) ) ,
357+ edition : Some ( Some ( edition) ) ,
358+ crate_type : Some ( crate_type) ,
336359 tests : None ,
337360 backtrace : None ,
338361 }
@@ -350,10 +373,10 @@ impl HasLabelsCore for coordinator::MiriRequest {
350373
351374 LabelsCore {
352375 target : None ,
353- channel : Some ( channel. into ( ) ) ,
376+ channel : Some ( channel) ,
354377 mode : None ,
355- edition : Some ( Some ( edition. into ( ) ) ) ,
356- crate_type : Some ( crate_type. into ( ) ) ,
378+ edition : Some ( Some ( edition) ) ,
379+ crate_type : Some ( crate_type) ,
357380 tests : None ,
358381 backtrace : None ,
359382 }
@@ -371,10 +394,10 @@ impl HasLabelsCore for coordinator::MacroExpansionRequest {
371394
372395 LabelsCore {
373396 target : None ,
374- channel : Some ( channel. into ( ) ) ,
397+ channel : Some ( channel) ,
375398 mode : None ,
376- edition : Some ( Some ( edition. into ( ) ) ) ,
377- crate_type : Some ( crate_type. into ( ) ) ,
399+ edition : Some ( Some ( edition) ) ,
400+ crate_type : Some ( crate_type) ,
378401 tests : None ,
379402 backtrace : None ,
380403 }
0 commit comments