-
Notifications
You must be signed in to change notification settings - Fork 506
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: Deep clone trace data for consistency #2571
Fix: Deep clone trace data for consistency #2571
Conversation
@@ -13,12 +13,14 @@ | |||
// limitations under the License. | |||
import React from 'react'; | |||
import { FlamegraphRenderer, convertJaegerTraceToProfile } from '@pyroscope/flamegraph'; | |||
import _cloneDeep from 'lodash/cloneDeep'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative is to use the global structuredClone
method, but it's still not supported in jsdom. The workaround would be:
// in TracePage/TraceFlamegraph/index.test.js
beforeAll(() => {
global.structuredClone = jest.fn((obj) => JSON.parse(JSON.stringify(obj)));
});
afterAll(() => {
structuredCloneSpy.mockRestore();
});
But we already have lodash installed, so might as well use it
does it actually resolve the original issue? Seems like a partial solution (a good one, to keep the trace unchanged). |
Yep, b/c now These values don't change no matter how many times we switch views. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2571 +/- ##
=======================================
Coverage 96.63% 96.63%
=======================================
Files 255 255
Lines 7731 7731
Branches 2012 1997 -15
=======================================
Hits 7471 7471
Misses 260 260 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kaung Zin Hein <kaungzinhein113@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Signed-off-by: Kaung Zin Hein <83657429+Zen-cronic@users.noreply.github.com>
Head branch was pushed to by a user without write access
348f1d2
to
8085e88
Compare
Thanks! |
Resolves #2483
Description of the changes
How was this change tested?
Timeline view:
Flamegraph view:
Navigating back and forth between flamegraph and timeline views no longer show inconsistent data
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test