From 98886d2e8b329dc7377043cda2334fd2eb1a7129 Mon Sep 17 00:00:00 2001 From: Sephyi Date: Sun, 19 Apr 2026 18:59:36 +0200 Subject: [PATCH] feat(observability): add tracing spans to key pipeline functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add `#[tracing::instrument]` to the three load-bearing stages of the commit-generation pipeline so span-aware debug output (e.g. `COMMITBEE_LOG=debug,commitbee::app=trace`) shows per-stage timing and a handful of high-signal fields: - `App::generate_commit` — provider, model - `AnalyzerService::extract_symbols` — file_count - `ContextBuilder::build` — symbols, diffs, files All spans use `skip_all` plus explicit fields so `Self`, raw file contents, and large collections are never recorded as span attributes. No function signatures or return types change; this is purely diagnostic. Closes audit entry F-013 from #3. --- src/app.rs | 4 ++++ src/services/analyzer.rs | 1 + src/services/context.rs | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/app.rs b/src/app.rs index cae18dc..1c36c14 100644 --- a/src/app.rs +++ b/src/app.rs @@ -98,6 +98,10 @@ impl App { self.generate_commit().await } + #[tracing::instrument( + skip_all, + fields(provider = %self.config.provider, model = %self.config.model) + )] async fn generate_commit(&mut self) -> Result<()> { if self.cancel_token.is_cancelled() { return Err(Error::Cancelled); diff --git a/src/services/analyzer.rs b/src/services/analyzer.rs index e6695ee..c6446de 100644 --- a/src/services/analyzer.rs +++ b/src/services/analyzer.rs @@ -139,6 +139,7 @@ impl AnalyzerService { /// Extract symbols from file changes using full file content + hunk mapping. /// Uses rayon to parse files in parallel across CPU cores. + #[tracing::instrument(skip_all, fields(file_count = changes.len()))] pub fn extract_symbols( &self, changes: &[FileChange], diff --git a/src/services/context.rs b/src/services/context.rs index 8c59f91..76d4950 100644 --- a/src/services/context.rs +++ b/src/services/context.rs @@ -36,6 +36,10 @@ const SKIP_CONTENT_FILES: &[&str] = &[ pub struct ContextBuilder; impl ContextBuilder { + #[tracing::instrument( + skip_all, + fields(symbols = symbols.len(), diffs = diffs.len(), files = changes.files.len()) + )] pub fn build( changes: &StagedChanges, symbols: &[CodeSymbol],