lightweight com.atproto.sync.listReposByCollection
45
fork

Configure Feed

Select the types of activity you want to include in your feed.

deep crawl metrics

phil 1fc29e35 9e8dd606

+29 -4
+29 -4
src/sync/deep_crawl.rs
··· 149 149 Ok(h) => h, 150 150 Err(e) => { 151 151 warn!(hostname = %hostname, error = %e, "failed to parse PDS hostname; skipping"); 152 + metrics::counter!("lightrail_deep_crawl_pds_discovered_total", "outcome" => "parse_error") 153 + .increment(1); 152 154 continue; 153 155 } 154 156 }; ··· 160 162 tokio::task::spawn_blocking(move || backfill_progress::get(&db, &h)).await?? 161 163 }; 162 164 if already_done.and_then(|p| p.completed_at).is_some() { 165 + metrics::counter!("lightrail_deep_crawl_pds_discovered_total", "outcome" => "skipped") 166 + .increment(1); 163 167 continue; 164 168 } 165 169 ··· 168 172 && let Some(result) = workers.join_next().await 169 173 { 170 174 log_worker_result(result); 175 + metrics::gauge!("lightrail_deep_crawl_workers").set(workers.len() as f64); 171 176 } 172 177 173 178 let db2 = db.clone(); ··· 178 183 let outcome = backfill::run(host2.clone(), db2, client2, child).await; 179 184 (host2, outcome) 180 185 }); 186 + metrics::gauge!("lightrail_deep_crawl_workers").set(workers.len() as f64); 187 + metrics::counter!("lightrail_deep_crawl_pds_discovered_total", "outcome" => "spawned") 188 + .increment(1); 181 189 182 190 info!(pds = %pds_host, "spawned deep crawl backfill worker"); 183 191 } ··· 208 216 while let Some(result) = workers.join_next().await { 209 217 log_worker_result(result); 210 218 } 219 + metrics::gauge!("lightrail_deep_crawl_workers").set(0.0); 211 220 } 212 221 213 222 fn log_worker_result(result: std::result::Result<(Host, Result<bool>), tokio::task::JoinError>) { 214 223 match result { 215 - Ok((host, Ok(true))) => info!(pds = %host, "deep crawl backfill worker completed"), 216 - Ok((host, Ok(false))) => info!(pds = %host, "deep crawl backfill worker cancelled"), 217 - Ok((host, Err(e))) => warn!(pds = %host, error = %e, "deep crawl backfill worker failed"), 218 - Err(e) => warn!(error = %e, "deep crawl backfill worker panicked"), 224 + Ok((host, Ok(true))) => { 225 + metrics::counter!("lightrail_deep_crawl_pds_completed_total", "outcome" => "completed") 226 + .increment(1); 227 + info!(pds = %host, "deep crawl backfill worker completed"); 228 + } 229 + Ok((host, Ok(false))) => { 230 + metrics::counter!("lightrail_deep_crawl_pds_completed_total", "outcome" => "cancelled") 231 + .increment(1); 232 + info!(pds = %host, "deep crawl backfill worker cancelled"); 233 + } 234 + Ok((host, Err(e))) => { 235 + metrics::counter!("lightrail_deep_crawl_pds_completed_total", "outcome" => "failed") 236 + .increment(1); 237 + warn!(pds = %host, error = %e, "deep crawl backfill worker failed"); 238 + } 239 + Err(e) => { 240 + metrics::counter!("lightrail_deep_crawl_pds_completed_total", "outcome" => "panicked") 241 + .increment(1); 242 + warn!(error = %e, "deep crawl backfill worker panicked"); 243 + } 219 244 } 220 245 }