Commit 1762de3
docs: add automatic request tracking design to NEXT-metrics-and-data.md
- Add comprehensive time-windowed counter tracking for contexts that call persist()
- Design automatic counters: since_start, last_day, last_hour, last_minute, last_second
- Use full dotted context paths as keys for hierarchical aggregation
- Zero manual tracking - persist() automatically updates all time window counters
- Add sliding window implementation with efficient circular buffers
- Include automatic rate calculation and trending capabilities
- Show hierarchical aggregation: context path enables automatic rollups
Example automatic tracking:
- ctx.persist() on "global.p2p.alice@bv478gen.stream-123"
- Auto-increments: requests_since_start, requests_last_hour, etc.
- Hierarchical: "global.p2p.requests_last_hour" aggregates all P2P
- Status shows: "1,247 total | 234 last hour | 45 last minute | 2/sec"
This provides comprehensive operational analytics without manual counter management.
Just persist contexts and get complete request tracking automatically.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 6d2e53c commit 1762de3
1 file changed
Lines changed: 54 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
0 commit comments