MCPcopy Index your code
hub / github.com/coder/coder / StatsCollector

Struct StatsCollector

coderd/workspaceapps/stats.go:78–89  ·  view source on GitHub ↗

StatsCollector collects workspace app StatsReports and reports them in batches, stats compaction is performed for short-lived sessions.

Source from the content-addressed store, hash-verified

76// StatsCollector collects workspace app StatsReports and reports them
77// in batches, stats compaction is performed for short-lived sessions.
78type 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
91type StatsCollectorOptions struct {
92 Logger *slog.Logger

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected