feat(server): add tracing spans and caching to archive and blame services

- Add tracing spans with repo labels for archive and blame operations
- Implement caching for archive list entries when using OID selectors
- Implement caching for blame operations when using OID selectors
- Add detailed
This commit is contained in:
zhenyi
2026-06-04 15:33:16 +08:00
parent 729604f13b
commit cc202d6d1f
41 changed files with 2400 additions and 1067 deletions
+12 -3
View File
@@ -10,17 +10,25 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenvy::dotenv().ok();
tracing_subscriber::fmt::init();
tracing::info!(
version = env!("CARGO_PKG_VERSION"),
"gitks starting up"
);
let host = std::env::var("GITKS_HOST").unwrap_or_else(|_| DEFAULT_HOST.into());
let port = std::env::var("GITKS_PORT").unwrap_or_else(|_| DEFAULT_PORT.into());
let repo_prefix = std::env::var("REPO_PREFIX_PATH").map_err(|_| {
"REPO_PREFIX_PATH environment variable is required (e.g. /data/repos)"
})?;
let repo_prefix = std::env::var("REPO_PREFIX_PATH")
.map_err(|_| "REPO_PREFIX_PATH environment variable is required (e.g. /data/repos)")?;
let repo_prefix = PathBuf::from(&repo_prefix);
if !repo_prefix.is_absolute() {
return Err("REPO_PREFIX_PATH must be an absolute path".into());
}
if !repo_prefix.exists() {
tracing::info!(
path = %repo_prefix.display(),
"creating repo prefix directory"
);
std::fs::create_dir_all(&repo_prefix)?;
}
@@ -33,5 +41,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
serve(addr, repo_prefix).await?;
tracing::info!("gitks shut down");
Ok(())
}