Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ebpf): merge equal samples #2788

Merged
merged 2 commits into from
Dec 1, 2023
Merged

fix(ebpf): merge equal samples #2788

merged 2 commits into from
Dec 1, 2023

Conversation

korniltsev
Copy link
Collaborator

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
Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

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

LGTM

Value: []int64{scaledValue},
}
p.sampleHashToSample[h] = sample
p.tmpLocations = nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Must be a leftover?

p.tmpLocationIDs = append(p.tmpLocationIDs, loc.ID)
}
p.hash.Reset()
if _, err := p.hash.Write(uint64Bytes(p.tmpLocationIDs)); err != nil {
Copy link
Collaborator

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
19 checks passed
@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