chore: Expand logging in ADCS Post-Process - BED-8305#2791
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAdds measurement wrappers (measure.ContextMeasure / ContextMeasureWithThreshold) to ADCS processing functions and cache-building loops; separately replaces sb.WriteString(fmt.Sprintf(...)) with fmt.Fprintf(&sb, ...) in two string-building sites. ChangesADCS Observability Instrumentation
String Builder / SQL Emission Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/go/analysis/ad/adcscache.go (1)
97-104: ⚡ Quick winGroup measure initializations in a single
varblock and expand abbreviated naming.These three measure handles are related and can be hoisted/grouped together; also prefer a richer name than
ecaMeasure(e.g.,enterpriseCAMeasure) for consistency.♻️ Proposed refactor
- certTemplateMeasure := measure.ContextMeasure( + var ( + certTemplateMeasure = measure.ContextMeasure( ctx, slog.LevelInfo, "BuildCache cert template loop", attr.Namespace("analysis"), attr.Function("BuildCache.CertTemplates"), attr.Scope("routine"), - ) + ) + enterpriseCAMeasure = measure.ContextMeasure( + ctx, + slog.LevelInfo, + "BuildCache enterprise CA loop", + attr.Namespace("analysis"), + attr.Function("BuildCache.EnterpriseCAs"), + attr.Scope("routine"), + ) + domainMeasure = measure.ContextMeasure( + ctx, + slog.LevelInfo, + "BuildCache domain loop", + attr.Namespace("analysis"), + attr.Function("BuildCache.Domains"), + attr.Scope("routine"), + ) + ) @@ - ecaMeasure := measure.ContextMeasure( - ctx, - slog.LevelInfo, - "BuildCache enterprise CA loop", - attr.Namespace("analysis"), - attr.Function("BuildCache.EnterpriseCAs"), - attr.Scope("routine"), - ) @@ - ecaMeasure() + enterpriseCAMeasure() @@ - domainMeasure := measure.ContextMeasure( - ctx, - slog.LevelInfo, - "BuildCache domain loop", - attr.Namespace("analysis"), - attr.Function("BuildCache.Domains"), - attr.Scope("routine"), - )As per coding guidelines: “Group variable initializations in a
var ( ... )block and hoist them to the top of the function when possible” and “Prefer rich variable names, for example:databaseInterfaceinstead ofdiordbi.”Also applies to: 146-153, 212-219
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/go/analysis/ad/adcscache.go` around lines 97 - 104, Hoist and group the related ContextMeasure initializations into a single var (...) block at the top of the BuildCache.CertTemplates function and replace the abbreviated ecaMeasure name with a clearer enterpriseCAMeasure (and similarly expand any other abbreviated measure names), e.g., declare certTemplateMeasure, enterpriseCAMeasure, and any other related measures together; ensure each measure still calls measure.ContextMeasure(...) with the same attributes and use the new variable names throughout the function. Also apply the same grouping and renaming pattern to the other similar measure sets in this file so all related measures are declared in var blocks with descriptive names and referenced consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/go/analysis/ad/adcscache.go`:
- Around line 97-104: Hoist and group the related ContextMeasure initializations
into a single var (...) block at the top of the BuildCache.CertTemplates
function and replace the abbreviated ecaMeasure name with a clearer
enterpriseCAMeasure (and similarly expand any other abbreviated measure names),
e.g., declare certTemplateMeasure, enterpriseCAMeasure, and any other related
measures together; ensure each measure still calls measure.ContextMeasure(...)
with the same attributes and use the new variable names throughout the function.
Also apply the same grouping and renaming pattern to the other similar measure
sets in this file so all related measures are declared in var blocks with
descriptive names and referenced consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 17c78755-5bb8-429f-82eb-81fa0b5b9710
📒 Files selected for processing (2)
packages/go/analysis/ad/adcs.gopackages/go/analysis/ad/adcscache.go
Description
Expands logging in ADCS post-processing functions to make identification of bottlenecks significantly faster
Motivation and Context
Resolves BED-8305
Why is this change required? What problem does it solve?
How Has This Been Tested?
I have been running multiple performance validations utilizing these log lines locally.
Screenshots (optional):
Types of changes
Checklist:
Summary by CodeRabbit