summaryrefslogtreecommitdiff
path: root/internal/statsengine/engine.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-18 19:13:59 +0300
committerPaul Buetow <paul@buetow.org>2026-05-18 19:13:59 +0300
commit65599ad9b87b1c61cb6d8232200da88952370e96 (patch)
tree862e20468835255ed06544a2df2470678d3b97dc /internal/statsengine/engine.go
parenta92cb0283b1ba8735a6697a8f94911397534131f (diff)
t6 add syscall family dashboard aggregation
Diffstat (limited to 'internal/statsengine/engine.go')
-rw-r--r--internal/statsengine/engine.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/internal/statsengine/engine.go b/internal/statsengine/engine.go
index b7d93fa..7d85e96 100644
--- a/internal/statsengine/engine.go
+++ b/internal/statsengine/engine.go
@@ -56,6 +56,7 @@ type Engine struct {
totalGap uint64
syscalls *syscallAccumulator
+ families *familyAccumulator
files *fileRanker
processes *processAccumulator
latencyHist *histogram
@@ -82,6 +83,7 @@ type snapshotInputs struct {
throughputSeries []float64
syscalls []syscallSnapshotInput
+ families []familySnapshotInput
files []fileSnapshotInput
processes []processSnapshotInput
@@ -104,6 +106,7 @@ func newEngineWithClock(topN int, now func() time.Time) *Engine {
startedAt: now(),
topN: topN,
syscalls: newSyscallAccumulator(),
+ families: newFamilyAccumulator(),
files: newFileRankerWithConfig(topN),
processes: newProcessAccumulatorWithConfig(topN),
latencyHist: newHistogram(),
@@ -132,6 +135,7 @@ func (e *Engine) Reset() {
e.totalLatency = 0
e.totalGap = 0
e.syscalls = newSyscallAccumulator()
+ e.families = newFamilyAccumulator()
e.files = newFileRankerWithConfig(e.topN)
e.processes = newProcessAccumulatorWithConfig(e.topN)
e.latencyHist = newHistogram()
@@ -158,6 +162,7 @@ func (e *Engine) Ingest(pair *event.Pair) {
e.updateErrorAndByteClasses(pair)
e.syscalls.Add(pair)
+ e.families.Add(pair)
e.files.Add(pair)
e.processes.Add(pair)
e.latencyHist.Increment(pair.Duration)
@@ -190,6 +195,7 @@ func (e *Engine) updateErrorAndByteClasses(pair *event.Pair) {
// subSnapshots holds the concurrently built per-category snapshot slices.
type subSnapshots struct {
syscalls []SyscallSnapshot
+ families []FamilySnapshot
files []FileSnapshot
processes []ProcessSnapshot
latencyHist HistogramSnapshot
@@ -216,6 +222,7 @@ func (e *Engine) captureSnapshotInputs() snapshotInputs {
gapSeries: e.gapSeries.Values(),
throughputSeries: e.throughputSeries.Values(),
syscalls: e.syscalls.snapshotInputs(),
+ families: e.families.snapshotInputs(),
files: e.files.snapshotInputs(),
processes: e.processes.snapshotInputs(),
latencyHist: e.latencyHist.snapshotInputs(),
@@ -223,7 +230,7 @@ func (e *Engine) captureSnapshotInputs() snapshotInputs {
}
}
-// buildSubSnapshots runs all five per-category snapshot builders concurrently
+// buildSubSnapshots runs all per-category snapshot builders concurrently
// using errgroup so that any error from a sub-builder is captured and returned
// to the caller instead of being silently dropped.
func buildSubSnapshots(in snapshotInputs, elapsed time.Duration) (subSnapshots, error) {
@@ -239,6 +246,11 @@ func buildSubSnapshots(in snapshotInputs, elapsed time.Duration) (subSnapshots,
})
eg.Go(func() error {
var err error
+ ss.families, err = buildFamilySnapshots(in.families, elapsed)
+ return err
+ })
+ eg.Go(func() error {
+ var err error
ss.files, err = buildFileSnapshots(in.files)
return err
})
@@ -303,9 +315,9 @@ func (e *Engine) Snapshot() (*Snapshot, error) {
return nil, err
}
- snap := NewSnapshot(
+ snap := NewSnapshotWithFamilies(
in.latencySeries, in.gapSeries, in.throughputSeries,
- ss.syscalls, ss.files, ss.processes,
+ ss.syscalls, ss.families, ss.files, ss.processes,
ss.latencyHist, ss.gapHist,
)
populateSnapshotFields(&snap, in, elapsed)