Skip to content

fix(ebpf): merge equal samples - #2788

Merged
korniltsev merged 2 commits into
mainfrom
ebpf_pprof_samples_merge
Dec 1, 2023
Merged

korniltsev merged 2 commits into
mainfrom
ebpf_pprof_samples_merge

Conversation

@korniltsev

Copy link
Copy Markdown
Contributor

Regular stacktraces are agregated in ebpf program by increasing value in the ebpf maps
Python stacktraces are different, they are sent to userspace as is without any aggregation, so we may end up with multiple equal samples and values=1.

In this PR I aggregate python samples so that pprofs are smaller.
In the future we may try to aggregate python samples in ebpf (this require adding hashing function to ebpf)

@korniltsev
korniltsev requested a review from a team as a code owner December 1, 2023 05:11
@korniltsev
korniltsev enabled auto-merge (squash) December 1, 2023 05:30

@kolesnikovae kolesnikovae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread ebpf/pprof/pprof.go
Value: []int64{scaledValue},
}
p.sampleHashToSample[h] = sample
p.tmpLocations = nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be a leftover?

Comment thread ebpf/pprof/pprof.go
p.tmpLocationIDs = append(p.tmpLocationIDs, loc.ID)
}
p.hash.Reset()
if _, err := p.hash.Write(uint64Bytes(p.tmpLocationIDs)); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to Write? Is there a way to Sum64([]byte)?

@korniltsev
korniltsev merged commit 131c5e3 into main Dec 1, 2023
@korniltsev
korniltsev deleted the ebpf_pprof_samples_merge branch December 1, 2023 05:33
korniltsev added a commit that referenced this pull request Dec 1, 2023
korniltsev added a commit that referenced this pull request Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants