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(readjob): Pass readjob result as pointer #542

Merged
merged 4 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
- Lower number of concurrent reads ([#537](https://github.com/getsentry/vroom/pull/537))
- Remove unused metrics summary kafka writer ([#538](https://github.com/getsentry/vroom/pull/538))
- Remove unused chunks flamegraph endpoint ([#541](https://github.com/getsentry/vroom/pull/541))
- Pass readjob result as pointer ([#542](https://github.com/getsentry/vroom/pull/542))

## 23.12.0

Expand Down
2 changes: 1 addition & 1 deletion cmd/vroom/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (env *environment) postProfileFromChunkIDs(w http.ResponseWriter, r *http.R
// sense to have a final profile with missing chunks
continue
}
chunks = append(chunks, result.Chunk)
chunks = append(chunks, *result.Chunk)
}
s.Finish()
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions internal/chunk/sample_readjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type (

ReadJobResult struct {
Err error
Chunk Chunk
Chunk *Chunk
TransactionID string
ThreadID *string
Start uint64
Expand All @@ -45,7 +45,7 @@ func (job ReadJob) Read() {

job.Result <- ReadJobResult{
Err: err,
Chunk: chunk,
Chunk: &chunk,
TransactionID: job.TransactionID,
ThreadID: job.ThreadID,
Start: job.Start,
Expand All @@ -62,8 +62,8 @@ type (

CallTreesReadJobResult struct {
Err error
CallTrees map[string][]*nodetree.Node
Chunk SampleChunk
CallTrees *map[string][]*nodetree.Node
Zylphrex marked this conversation as resolved.
Show resolved Hide resolved
Chunk *SampleChunk
TransactionID string
ThreadID *string
Start uint64
Expand All @@ -89,8 +89,8 @@ func (job CallTreesReadJob) Read() {

job.Result <- CallTreesReadJobResult{
Err: err,
CallTrees: callTrees,
Chunk: chunk,
CallTrees: &callTrees,
Chunk: &chunk,
TransactionID: job.TransactionID,
ThreadID: job.ThreadID,
Start: job.Start,
Expand Down
6 changes: 3 additions & 3 deletions internal/flamegraph/flamegraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,13 @@ func GetFlamegraphFromCandidates(
example := utils.NewExampleFromProfileID(result.Profile.ProjectID(), result.Profile.ID())
annotate := annotateWithProfileExample(example)

for _, callTree := range result.CallTrees {
for _, callTree := range *result.CallTrees {
addCallTreeToFlamegraph(&flamegraphTree, callTree, annotate)
}
// if metrics aggregator is not null, while we're at it,
// compute the metrics as well
if ma != nil {
functions := metrics.CapAndFilterFunctions(metrics.ExtractFunctionsFromCallTrees(result.CallTrees), int(ma.MaxUniqueFunctions), true)
functions := metrics.CapAndFilterFunctions(metrics.ExtractFunctionsFromCallTrees(*result.CallTrees), int(ma.MaxUniqueFunctions), true)
ma.AddFunctions(functions, example)
}

Expand All @@ -466,7 +466,7 @@ func GetFlamegraphFromCandidates(
chunkProfileSpan := span.StartChild("calltree")
chunkProfileSpan.Description = "continuous profile"

for threadID, callTree := range result.CallTrees {
for threadID, callTree := range *result.CallTrees {
if result.Start > 0 && result.End > 0 {
interval := utils.Interval{
Start: result.Start,
Expand Down
12 changes: 6 additions & 6 deletions internal/profile/readjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type (

ReadJobResult struct {
Err error
Profile Profile
Profile *Profile
}
)

Expand All @@ -34,7 +34,7 @@ func (job ReadJob) Read() {
&profile,
)

job.Result <- ReadJobResult{Profile: profile, Err: err}
job.Result <- ReadJobResult{Profile: &profile, Err: err}
}

func (result ReadJobResult) Error() error {
Expand All @@ -46,8 +46,8 @@ type (

CallTreesReadJobResult struct {
Err error
CallTrees map[uint64][]*nodetree.Node
Profile Profile
CallTrees *map[uint64][]*nodetree.Node
Zylphrex marked this conversation as resolved.
Show resolved Hide resolved
Profile *Profile
}
)

Expand All @@ -69,8 +69,8 @@ func (job CallTreesReadJob) Read() {
callTrees, err := profile.CallTrees()

job.Result <- CallTreesReadJobResult{
CallTrees: callTrees,
Profile: profile,
CallTrees: &callTrees,
Profile: &profile,
Err: err,
}
}
Expand Down
Loading