Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Conversation

eh-am
Copy link
Collaborator

@eh-am eh-am commented Apr 12, 2023

Add support for diff:
Screenshot 2023-04-24 at 14 33 54

Given 2 trees, it generates a *querierv1.FlameGraphDiff in diff format. I preferred this way (instead of reusing Flamegraph) to make it clear its semantics and shape are the same (for example, leftTicks/rightTicks are required).

Before implementing I had 2 approaches in mind:

Ended up using the second approach, since it doesn't require an extra conversion, plus it gives us more flexibility.

Added the bare minimum changes to get it working. Haven't checked performance nor anything like that. So feel free to suggest improvements :)

Drawbacks

  • It only supports positive nodes. I added an assertion at the beginning. Don't fully understand the data model, so decided to fail early and deal with it properly when we have real data that fails this assertion.

@eh-am eh-am marked this pull request as ready for review April 24, 2023 14:07
@eh-am eh-am requested a review from petethepig April 24, 2023 14:08
Copy link
Contributor

@Rperry2174 Rperry2174 left a comment

Choose a reason for hiding this comment

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

LGTM -- I'd say just create an issue for the outstanding items so we don't forget, but I think we can merge this and follow up in future PRs.

Nice job!!!

image

@Rperry2174
Copy link
Contributor

also for future viewers/testers worth noting that grafana/pyroscope#1935 adds example in pyroscope repo works with phlare for testing these kings of things

Copy link
Contributor

@petethepig petethepig left a comment

Choose a reason for hiding this comment

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

LGTM, found a nit and a potential bug, but it's really good overall.

}()

var leftTree, rightTree *tree
g, gCtx := errgroup.WithContext(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@eh-am eh-am merged commit 0aa3f23 into main Apr 26, 2023
@eh-am eh-am deleted the feat/diff branch April 26, 2023 10:14
simonswine pushed a commit to simonswine/pyroscope that referenced this pull request Jun 30, 2023
Given 2 trees, it generates a *querierv1.FlameGraphDiff in diff format. I preferred this way (instead of reusing Flamegraph) to make it clear its semantics and shape are the same (for example, leftTicks/rightTicks are required).

Before implementing I had 2 approaches in mind:

    Write code to convert from phlare's tree into pyroscope's tree, then just defer to pyroscope's code.
    Copy the diff implementation from pyroscope OG.

Ended up using the second approach, since it doesn't require an extra conversion, plus it gives us more flexibility.

Added the bare minimum changes to get it working. Haven't checked performance nor anything like that. So feel free to suggest improvements :)
Drawbacks

    It only supports positive nodes. I added an assertion at the beginning. Don't fully understand the data model, so decided to fail early and deal with it properly when we have real data that fails this assertion.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants