1
1
use lazy_static:: lazy_static;
2
- use orchestrator:: coordinator;
2
+ use orchestrator:: coordinator:: { self , Channel , CompileTarget , CrateType , Edition , Mode } ;
3
3
use prometheus:: {
4
4
self , register_histogram, register_histogram_vec, register_int_counter,
5
5
register_int_counter_vec, register_int_gauge, Histogram , HistogramVec , IntCounter ,
@@ -10,7 +10,7 @@ use std::{
10
10
time:: { Duration , Instant } ,
11
11
} ;
12
12
13
- use crate :: sandbox:: { self , Channel , CompileTarget , CrateType , Edition , Mode } ;
13
+ use crate :: sandbox;
14
14
15
15
lazy_static ! {
16
16
pub ( crate ) static ref REQUESTS : HistogramVec = register_histogram_vec!(
@@ -132,15 +132,38 @@ impl Labels {
132
132
v. map_or ( "" , |v| if v { "true" } else { "false" } )
133
133
}
134
134
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
+ } ;
138
154
let edition = match edition {
139
155
None => "" ,
140
156
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 => "" ,
142
166
} ;
143
- let crate_type = crate_type. map_or ( "" , Into :: into) ;
144
167
let tests = b ( tests) ;
145
168
let backtrace = b ( backtrace) ;
146
169
@@ -262,11 +285,11 @@ impl HasLabelsCore for coordinator::CompileRequest {
262
285
} = * self ;
263
286
264
287
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) ,
270
293
tests : Some ( tests) ,
271
294
backtrace : Some ( backtrace) ,
272
295
}
@@ -287,10 +310,10 @@ impl HasLabelsCore for coordinator::ExecuteRequest {
287
310
288
311
LabelsCore {
289
312
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) ,
294
317
tests : Some ( tests) ,
295
318
backtrace : Some ( backtrace) ,
296
319
}
@@ -308,10 +331,10 @@ impl HasLabelsCore for coordinator::FormatRequest {
308
331
309
332
LabelsCore {
310
333
target : None ,
311
- channel : Some ( channel. into ( ) ) ,
334
+ channel : Some ( channel) ,
312
335
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) ,
315
338
tests : None ,
316
339
backtrace : None ,
317
340
}
@@ -329,10 +352,10 @@ impl HasLabelsCore for coordinator::ClippyRequest {
329
352
330
353
LabelsCore {
331
354
target : None ,
332
- channel : Some ( channel. into ( ) ) ,
355
+ channel : Some ( channel) ,
333
356
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) ,
336
359
tests : None ,
337
360
backtrace : None ,
338
361
}
@@ -350,10 +373,10 @@ impl HasLabelsCore for coordinator::MiriRequest {
350
373
351
374
LabelsCore {
352
375
target : None ,
353
- channel : Some ( channel. into ( ) ) ,
376
+ channel : Some ( channel) ,
354
377
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) ,
357
380
tests : None ,
358
381
backtrace : None ,
359
382
}
@@ -371,10 +394,10 @@ impl HasLabelsCore for coordinator::MacroExpansionRequest {
371
394
372
395
LabelsCore {
373
396
target : None ,
374
- channel : Some ( channel. into ( ) ) ,
397
+ channel : Some ( channel) ,
375
398
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) ,
378
401
tests : None ,
379
402
backtrace : None ,
380
403
}
0 commit comments