[WIP] Fix trend data collection in api consumption report#32638
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
May 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the api-consumption-report workflow prompt to improve trend/history data collection, especially on first run or when cache history is sparse.
Changes:
- Adds a cache-history “entry count” check to choose between incremental (
-1d) and backfill (-90d) log collection. - Introduces a
backfill_entries.jsonartifact format for per-day summaries when running in backfill mode. - Replaces “append” guidance with explicit merge/upsert-by-date logic and adds discussion metadata fields for collection mode/start date.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/api-consumption-report.md |
Enhances the prompt to support backfill collection and deterministic merging of daily trend history. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 3
Comment on lines
+58
to
+66
| Before calling `logs`, inspect the cache state to choose a collection window: | ||
|
|
||
| ```bash | ||
| history_file="/tmp/gh-aw/cache-memory/trending/api-consumption/history.jsonl" | ||
| entry_count=0 | ||
| if [ -f "$history_file" ]; then | ||
| if ! entry_count=$(wc -l < "$history_file"); then | ||
| echo "warning: unable to count existing history entries; defaulting to 0" | ||
| entry_count=0 |
Comment on lines
+71
to
74
| Use the `agentic-workflows` MCP `logs` tool with this rule (assuming one deduplicated row per day after Step 3 merge; 30 entries is roughly 30 days of daily points, enough for stable 7-day and 30-day trend visuals): | ||
|
|
||
| - If `entry_count >= 30` (history is already rich): collect only incremental data: | ||
|
|
Comment on lines
+163
to
+169
| Structure: | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "date": "2024-01-14", | ||
| "recorded_at": "2024-01-14-23-59-59", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
api-consumption-reportworkflow source and related context