@@ -14,7 +14,6 @@ use crate::{
14
14
extractors:: { DbConnection , Path } ,
15
15
file:: File ,
16
16
match_version,
17
- metrics:: RenderingTimesRecorder ,
18
17
page:: TemplateData ,
19
18
MetaData , ReqVersion ,
20
19
} ,
@@ -90,7 +89,6 @@ async fn try_serve_legacy_toolchain_asset(
90
89
#[ instrument( skip_all) ]
91
90
pub ( crate ) async fn rustdoc_redirector_handler (
92
91
Path ( params) : Path < RustdocRedirectorParams > ,
93
- Extension ( metrics) : Extension < Arc < InstanceMetrics > > ,
94
92
Extension ( storage) : Extension < Arc < AsyncStorage > > ,
95
93
Extension ( config) : Extension < Arc < Config > > ,
96
94
mut conn : DbConnection ,
@@ -116,16 +114,13 @@ pub(crate) async fn rustdoc_redirector_handler(
116
114
) ?)
117
115
}
118
116
119
- let mut rendering_time = RenderingTimesRecorder :: new ( & metrics. rustdoc_redirect_rendering_times ) ;
120
-
121
117
// global static assets for older builds are served from the root, which ends up
122
118
// in this handler as `params.name`.
123
119
if let Some ( ( _, extension) ) = params. name . rsplit_once ( '.' ) {
124
120
if [ "css" , "js" , "png" , "svg" , "woff" , "woff2" ]
125
121
. binary_search ( & extension)
126
122
. is_ok ( )
127
123
{
128
- rendering_time. step ( "serve static asset" ) ;
129
124
return try_serve_legacy_toolchain_asset ( storage, config, params. name )
130
125
. instrument ( info_span ! ( "serve static asset" ) )
131
126
. await ;
@@ -162,7 +157,6 @@ pub(crate) async fn rustdoc_redirector_handler(
162
157
163
158
// it doesn't matter if the version that was given was exact or not, since we're redirecting
164
159
// anyway
165
- rendering_time. step ( "match version" ) ;
166
160
let matched_release = match_version (
167
161
& mut conn,
168
162
& crate_name,
@@ -177,21 +171,16 @@ pub(crate) async fn rustdoc_redirector_handler(
177
171
if let Some ( ref target) = params. target {
178
172
if target. ends_with ( ".js" ) {
179
173
// this URL is actually from a crate-internal path, serve it there instead
180
- rendering_time. step ( "serve JS for crate" ) ;
181
-
182
174
return async {
183
175
let krate = CrateDetails :: from_matched_release ( & mut conn, matched_release) . await ?;
184
176
185
- rendering_time. step ( "fetch from storage" ) ;
186
-
187
177
match storage
188
178
. fetch_rustdoc_file (
189
179
& crate_name,
190
180
& krate. version . to_string ( ) ,
191
181
krate. latest_build_id . unwrap_or ( 0 ) ,
192
182
target,
193
183
krate. archive_storage ,
194
- Some ( & mut rendering_time) ,
195
184
)
196
185
. await
197
186
{
@@ -231,8 +220,6 @@ pub(crate) async fn rustdoc_redirector_handler(
231
220
}
232
221
233
222
if matched_release. rustdoc_status ( ) {
234
- rendering_time. step ( "redirect to doc" ) ;
235
-
236
223
let url_str = if let Some ( target) = target {
237
224
format ! (
238
225
"/{crate_name}/{}/{target}/{}/" ,
@@ -261,7 +248,6 @@ pub(crate) async fn rustdoc_redirector_handler(
261
248
) ?
262
249
. into_response ( ) )
263
250
} else {
264
- rendering_time. step ( "redirect to crate" ) ;
265
251
Ok ( axum_cached_redirect (
266
252
format ! ( "/crate/{crate_name}/{}" , matched_release. req_version) ,
267
253
CachePolicy :: ForeverInCdn ,
@@ -361,8 +347,6 @@ pub(crate) async fn rustdoc_html_server_handler(
361
347
Extension ( csp) : Extension < Arc < Csp > > ,
362
348
uri : Uri ,
363
349
) -> AxumResult < AxumResponse > {
364
- let mut rendering_time = RenderingTimesRecorder :: new ( & metrics. rustdoc_rendering_times ) ;
365
-
366
350
// since we directly use the Uri-path and not the extracted params from the router,
367
351
// we have to percent-decode the string here.
368
352
let original_path = percent_encoding:: percent_decode ( uri. path ( ) . as_bytes ( ) )
@@ -394,8 +378,6 @@ pub(crate) async fn rustdoc_html_server_handler(
394
378
}
395
379
396
380
trace ! ( "match version" ) ;
397
- rendering_time. step ( "match version" ) ;
398
-
399
381
let mut conn = pool. get_async ( ) . await ?;
400
382
401
383
// Check the database for releases with the requested version while doing the following:
@@ -430,13 +412,10 @@ pub(crate) async fn rustdoc_html_server_handler(
430
412
} ) ?;
431
413
432
414
trace ! ( "crate details" ) ;
433
- rendering_time. step ( "crate details" ) ;
434
-
435
415
// Get the crate's details from the database
436
416
let krate = CrateDetails :: from_matched_release ( & mut conn, matched_release) . await ?;
437
417
438
418
if !krate. rustdoc_status {
439
- rendering_time. step ( "redirect to crate" ) ;
440
419
return Ok ( axum_cached_redirect (
441
420
format ! ( "/crate/{}/{}" , params. name, params. version) ,
442
421
CachePolicy :: ForeverInCdn ,
@@ -465,10 +444,6 @@ pub(crate) async fn rustdoc_html_server_handler(
465
444
466
445
trace ! ( ?storage_path, ?req_path, "try fetching from storage" ) ;
467
446
468
- // record the data-fetch step
469
- // until we re-add it below inside `fetch_rustdoc_file`
470
- rendering_time. step ( "fetch from storage" ) ;
471
-
472
447
// Attempt to load the file from the database
473
448
let blob = match storage
474
449
. fetch_rustdoc_file (
@@ -477,7 +452,6 @@ pub(crate) async fn rustdoc_html_server_handler(
477
452
krate. latest_build_id . unwrap_or ( 0 ) ,
478
453
& storage_path,
479
454
krate. archive_storage ,
480
- Some ( & mut rendering_time) ,
481
455
)
482
456
. await
483
457
{
@@ -541,16 +515,13 @@ pub(crate) async fn rustdoc_html_server_handler(
541
515
// Serve non-html files directly
542
516
if !storage_path. ends_with ( ".html" ) {
543
517
trace ! ( ?storage_path, "serve asset" ) ;
544
- rendering_time. step ( "serve asset" ) ;
545
518
546
519
// default asset caching behaviour is `Cache::ForeverInCdnAndBrowser`.
547
520
// This is an edge-case when we serve invocation specific static assets under `/latest/`:
548
521
// https://github.com/rust-lang/docs.rs/issues/1593
549
522
return Ok ( File ( blob) . into_response ( ) ) ;
550
523
}
551
524
552
- rendering_time. step ( "find latest path" ) ;
553
-
554
525
let latest_release = krate. latest_release ( ) ?;
555
526
556
527
// Get the latest version of the crate
@@ -618,8 +589,6 @@ pub(crate) async fn rustdoc_html_server_handler(
618
589
format ! ( "{target}/" )
619
590
} ;
620
591
621
- rendering_time. step ( "rewrite html" ) ;
622
-
623
592
// Build the page of documentation,
624
593
templates
625
594
. render_in_threadpool ( {
0 commit comments