StatsCollector collects workspace app StatsReports and reports them in batches, stats compaction is performed for short-lived sessions.
| 76 | // StatsCollector collects workspace app StatsReports and reports them |
| 77 | // in batches, stats compaction is performed for short-lived sessions. |
| 78 | type StatsCollector struct { |
| 79 | opts StatsCollectorOptions |
| 80 | |
| 81 | ctx context.Context |
| 82 | cancel context.CancelFunc |
| 83 | done chan struct{} |
| 84 | |
| 85 | mu sync.Mutex // Protects following. |
| 86 | statsBySessionID map[uuid.UUID]*StatsReport // Track unique sessions. |
| 87 | groupedStats map[statsGroupKey][]*StatsReport // Rolled up stats for sessions in close proximity. |
| 88 | backlog []StatsReport // Stats that have not been reported yet (due to error). |
| 89 | } |
| 90 | |
| 91 | type StatsCollectorOptions struct { |
| 92 | Logger *slog.Logger |
nothing calls this directly
no outgoing calls
no test coverage detected