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

support generating a flamegraph from a list of chunk IDs #476

Merged
merged 9 commits into from
Jul 4, 2024

Conversation

viglia
Copy link
Contributor

@viglia viglia commented Jun 21, 2024

No description provided.

@viglia viglia self-assigned this Jun 21, 2024
@viglia viglia requested a review from a team as a code owner June 21, 2024 13:08
when a chunk has a start and stop ts specified, we'll slice the callTree
in order to only use data within that time-range to generate the
flamegraph.
@viglia viglia requested review from Zylphrex and phacops June 28, 2024 13:17
Comment on lines 368 to 370
if errors.Is(res.Err, context.DeadlineExceeded) {
return speedscope.Output{}, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Thinking out loud here but if the result of 1 chunk is a deadline exceeded, and the rest succeeds, should we still return the flamegraph with the successful results anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question.

For the flamechart endpoint, where we want to return a merged sequence of chunks as a unified profile, even if 1 chunk fails for whatever reason (not only timeout), we return an error as the final merged chunk wouldn't make sense with gaps in it.

For the flamegraph, being it an aggregation, I agree with you that this should not be a big issue and partial flamegraph is still better than no flamegraph.
The reason I'm returning the error with an empty flamegraph here though, is that the context (ctx) we pass to the goroutine is the one from the parent request, so if that operation failed due to a context.DeadlineExceeded, we've likely exceeded the parent timeout so the whole request timed-out at that point and returning a partial one won't make a difference at this point.

}

sp := toSpeedscope(flamegraphTree, 4, projectID)
hub.Scope().SetTag("processed_chunks", strconv.Itoa(countChunksAggregated))
Copy link
Member

Choose a reason for hiding this comment

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

Could be helpful to set the number of chunks requested as well. And this could be more useful as a metric/measurement (whatever is possible) than a tag because sending this as a string is not very useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll add the requested_chunk as well to the tags in the endpoint I'll add to handle the request (similarly to what we do for the other flamegraph endpoint).

And this could be more useful as a metric/measurement (whatever is possible)

Yes. That's better handled on the Sentry side of the request though as we have the utilities in the python SDK to easily create metrics.

viglia added 3 commits July 4, 2024 09:47
Each interval that we want to slice our chunk on, might belong to a
different span that was created on a different thread.

This takes care of that. Moreover, in this way we can optimize and re-use the same chunk instead of downloading the same chunk multiple times.
return the error instead of nil
@viglia viglia merged commit 0ba266b into main Jul 4, 2024
11 checks passed
@viglia viglia deleted the viglia/feat/add-flamegrtaph-generation-from-chunks branch July 4, 2024 09:43
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