summaryrefslogtreecommitdiff
path: root/internal/flamegraph/livetrie.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-27 08:06:29 +0300
committerPaul Buetow <paul@buetow.org>2026-05-27 08:06:29 +0300
commit60e9a8fc836dc60ca5038890f3a0fa646ee2450b (patch)
treef037d045ac00e49d496c88a8329e41ec5109042c /internal/flamegraph/livetrie.go
parent3d3fcacbdc28c4296b1477e34999011b5a7d93f2 (diff)
fix(flamegraph): lock metric field reads in AddRecord (1p)
Diffstat (limited to 'internal/flamegraph/livetrie.go')
-rw-r--r--internal/flamegraph/livetrie.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/flamegraph/livetrie.go b/internal/flamegraph/livetrie.go
index a510a72..47299e6 100644
--- a/internal/flamegraph/livetrie.go
+++ b/internal/flamegraph/livetrie.go
@@ -102,19 +102,22 @@ func (lt *LiveTrie) Ingest(ep *event.Pair) {
// AddRecord adds one already-decoded flamegraph record into the live trie.
func (lt *LiveTrie) AddRecord(record IterRecord) {
+ lt.mu.Lock()
+
value, err := record.Cnt.ValueByName(lt.countField)
if err != nil {
+ lt.mu.Unlock()
return
}
heightValue := uint64(0)
if lt.heightField != "" {
heightValue, err = record.Cnt.ValueByName(lt.heightField)
if err != nil {
+ lt.mu.Unlock()
return
}
}
- lt.mu.Lock()
frames := lt.buildFrames(record)
lt.addLocked(frames, value, heightValue)
lt.version.Add(1)