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

Normalize stack frames with Lambda class names #320

Merged
merged 2 commits into from
Mar 1, 2021
Merged

Conversation

big-guy
Copy link
Member

@big-guy big-guy commented Feb 26, 2021

Lambda names are auto-generated and change from build to build. This
makes it difficult to compare flamegraphs since the stack may look very
different but ultimately be exactly the same

Lambda names are auto-generated and change from build to build. This
makes it difficult to compare flamegraphs since the stack may look very
different but ultimately be exactly the same
@big-guy big-guy self-assigned this Feb 26, 2021
@big-guy big-guy requested a review from wolfs February 26, 2021 04:02
Copy link
Member

@wolfs wolfs left a comment

Choose a reason for hiding this comment

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

I left a comment.

protected String mapFrame(String frame) {
// Lambdas contain a name that's based on an index + timestamp at runtime and changes build-to-build.
// This makes comparing two builds very difficult when a lambda is in the stack
return frame.replaceFirst(Pattern.quote("$$Lambda$")+"[0-9/]+", "\\$\\$Lambda\\$");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return frame.replaceFirst(Pattern.quote("$$Lambda$")+"[0-9/]+", "\\$\\$Lambda\\$");
return frame.replaceFirst(Pattern.quote("$$Lambda$")+"[0-9./]+", "\\$\\$Lambda\\$");

Can you leave the . and the /? That way we also normalize Lambdas for different Java versions correctly.

. and / are used depending on JVM version
Copy link
Member

@wolfs wolfs left a comment

Choose a reason for hiding this comment

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

LGTM!

@wolfs wolfs merged commit 134b54f into master Mar 1, 2021
@wolfs wolfs deleted the sg/lambda/flamegraph branch March 1, 2021 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants