
buildbuddy-usage-analysis
by sluongng
dotfiles and configurations for personal developement environment
SKILL.md
name: buildbuddy-usage-analysis description: Analyze BuildBuddy billing usage and trends data, fetch GetUsage/GetTrend/GetStatHeatmap/GetStatDrilldown/SearchInvocation/SearchExecution data, compare periods, spot anomalies, and recommend cost-saving actions while protecting API keys. metadata: short-description: Analyze BuildBuddy usage trends and cost anomalies.
BuildBuddy Usage Analysis
Overview
Fetch usage + trends data from BuildBuddyService, store responses in a temp dir, analyze for spikes/drops, and recommend cost savings. Prioritize API key safety and small time windows.
Quick start
- Use
references/requests.mdto setBASE_URL,API_KEY,GROUP_ID, andOUT_DIR. - Call
GetUsagefor current and prior months. - Call
GetTrendfor a time window aligned with the usage comparison. - Use the analyzer script or ad‑hoc math to compare and project.
Preconditions and access
- Verify API key presence without printing it:
git config --local buildbuddy.api-key | wc -c. - If
GetUserreturnsNotFound(common with org API keys), useGetGroupwithurlIdentifierto resolveGROUP_ID. GetUsageis admin-only. If you getPermissionDenied, switch to an org admin key or admin user for the group.
Fetch data (usage + trends)
Use the request templates in references/requests.md:
GetUsagefor the current month and the prior month (billing comparisons).GetTrendfor the same window (time-series context and cache hit rates).- If drilling down:
GetStatHeatmap,GetStatDrilldown, thenSearchInvocationorSearchExecutionfor sample events.
Notes:
- Keep windows small (days/weeks) to reduce payload size.
- JSON fields are lowerCamelCase (e.g.,
dailyUsage,actionCacheHits).
Visual URLs (trends + drilldown)
Use the org base URL from GetGroup (field url).
Trends charts:
<ORG_URL>/trends/?start=YYYY-MM-DD&end=YYYY-MM-DD#builds
<ORG_URL>/trends/?start=YYYY-MM-DD&end=YYYY-MM-DD#cache
<ORG_URL>/trends/?start=YYYY-MM-DD&end=YYYY-MM-DD#cas
<ORG_URL>/trends/?start=YYYY-MM-DD&end=YYYY-MM-DD#savings
Drilldown view:
<ORG_URL>/trends/?start=YYYY-MM-DD&end=YYYY-MM-DD#drilldown&ddMetric=i<INVOCATION_METRIC_ENUM>
Common query params: start, end, days, user, repo, branch, commit, host, command, pattern, tag, status, role.
ddMetric format is i<invocationEnum> or e<executionEnum> (use the stat_filter metric enums from your API docs). Drilldown selections can be pinned via ddSelection or ddZoom (heatmap selection encoding: start|end|bucketStart|bucketEnd|eventsSelected).
Example URLs (agent can adapt as-is):
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#builds
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#cache
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#cas
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#savings
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#drilldown&ddMetric=i1
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#drilldown&ddMetric=i4
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#drilldown&ddMetric=e7
<ORG_URL>/trends/?start=2026-01-01&end=2026-01-31#drilldown&ddMetric=e9
Example ddMetric labels:
i1= invocation duration (total build duration)i4= invocation cache download size (CAS download bytes)e7= execution input download size (RBE cache download bytes)e9= execution wall time (total execution time)
All ddMetric values (agent can use directly):
Invocation metrics (i*)
i1duration (total build duration)i2CAS cache missesi3updated at (timestamp)i4CAS cache download size (bytes)i5CAS cache download speed (bytes/sec)i6CAS cache upload size (bytes)i7CAS cache upload speed (bytes/sec)i8action cache missesi9time saved (cached execution time)
Execution metrics (e*)
e1queue timee2updated at (timestamp)e3input download timee4real execution timee5output upload timee6peak memorye7input download sizee8output upload sizee9execution wall timee10execution CPU nanose11execution average millicores
Analyze for anomalies
Use quick ad-hoc analysis (jq / python) or the script:
scripts/analyze_usage_trends.py --usage usage.json --trend trend.json
Look for:
- Spikes in
totalDownloadSizeBytesortotalUploadSizeBytes. - Drops in
actionCacheHitsorcasCacheHits. - Drops in action cache hit rate:
actionCacheHits / (actionCacheHits + actionCacheMisses)from trend stats. - Large changes in execution time or CPU nanos (
cloudCpuNanos,cloudRbeCpuNanos).
Project month-to-date usage
- Use
dailyUsageto find the latest reported day (the array may not start on day 1). - Project full-month totals by scaling
usagetotals byfull_days / last_reported_day. - Call out the projection method and the last reported date explicitly.
Recommendations
When anomalies are found, prioritize cost-saving advice:
- Action Cache: reduce non-determinism, align toolchains, enable remote cache for CI.
- Download egress: avoid downloading large outputs, prefer minimal downloads, limit artifact retention.
- Drill down: use
GetStatDrilldownto identify top users/repos/targets, then inspect sample invocations. - For a specific invocation investigation, use
buildbuddy-invocation-troubleshoot.
Resources
references/requests.md: request templates with safe API key handling and UI URLs.scripts/analyze_usage_trends.py: anomaly detector for usage/trends JSON.
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
1ヶ月以内に更新
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です

