Skip to content

optionally collect compiler metrics #2812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock"
- ".rustwide-docker:/opt/docsrs/rustwide"
- "cratesio-index:/opt/docsrs/prefix/crates.io-index"
- "./ignored/cratesfyi-prefix/metrics:/opt/docsrs/prefix/metrics"
- "./static:/opt/docsrs/static:ro"
environment:
DOCSRS_RUSTWIDE_WORKSPACE: /opt/docsrs/rustwide
DOCSRS_COMPILER_METRICS_PATH: /opt/docsrs/prefix/metrics
DOCSRS_DATABASE_URL: postgresql://cratesfyi:password@db
DOCSRS_STORAGE_BACKEND: s3
S3_ENDPOINT: http://s3:9000
Expand Down
1 change: 1 addition & 0 deletions src/bin/cratesfyi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ impl BuildSubcommand {
.as_ref()
.map(|s| PackageKind::Registry(s.as_str()))
.unwrap_or(PackageKind::CratesIo),
true,
)
.context("Building documentation failed")?;
}
Expand Down
7 changes: 4 additions & 3 deletions src/build_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub(crate) struct QueuedCrate {
pub(crate) version: String,
pub(crate) priority: i32,
pub(crate) registry: Option<String>,
pub(crate) attempt: i32,
}

#[derive(Debug)]
Expand Down Expand Up @@ -165,7 +166,7 @@ impl AsyncBuildQueue {

Ok(sqlx::query_as!(
QueuedCrate,
"SELECT id, name, version, priority, registry
"SELECT id, name, version, priority, registry, attempt
FROM queue
WHERE attempt < $1
ORDER BY priority ASC, attempt ASC, id ASC",
Expand Down Expand Up @@ -495,7 +496,7 @@ impl BuildQueue {
let to_process = match self.runtime.block_on(
sqlx::query_as!(
QueuedCrate,
"SELECT id, name, version, priority, registry
"SELECT id, name, version, priority, registry, attempt
FROM queue
WHERE
attempt < $1 AND
Expand Down Expand Up @@ -646,7 +647,7 @@ impl BuildQueue {
return Err(err);
}

builder.build_package(&krate.name, &krate.version, kind)
builder.build_package(&krate.name, &krate.version, kind, krate.attempt == 0)
})?;

Ok(processed)
Expand Down
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ pub struct Config {
// for the remote archives?
pub(crate) local_archive_cache_path: PathBuf,

// Where to collect metrics for the metrics initiative.
// When empty, we won't collect metrics.
pub(crate) compiler_metrics_collection_path: Option<PathBuf>,

// Content Security Policy
pub(crate) csp_report_only: bool,

Expand Down Expand Up @@ -226,6 +230,8 @@ impl Config {
prefix.join("archive_cache"),
)?,

compiler_metrics_collection_path: maybe_env("DOCSRS_COMPILER_METRICS_PATH")?,

temp_dir,

rustwide_workspace: env("DOCSRS_RUSTWIDE_WORKSPACE", PathBuf::from(".workspace"))?,
Expand Down
Loading
Loading