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

Add totalMemory in config for trace graph #1262

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

ChenX1993
Copy link
Contributor

Trace graph has a problem to renders large traces (with ~15K+ spans), and gives the error "Cannot enlarge memory arrays". Need to give users flexibility to control the totalMemory of LayoutManager used for TraceGraph.

Which problem is this PR solving?

Short description of the changes

Trace graph has a problem to renders large traces (with ~15K+ spans), and gives the error "Cannot enlarge memory arrays". This can be fixed by providing a larger number of memory when initializing the LayoutManager in trace graph, like below:

// default 16MB
this.layoutManager = new LayoutManager({ totalMemory: 33554432, useDotEdges: true, splines: 'polyline' });

But instead of hardcoding the memory value in code, we want to give users the flexibility to control the totalMemory of LayoutManager for TraceGraph.

@@ -164,4 +164,14 @@ export type Config = {
menuEnabled?: boolean;
menuLabel?: string;
};

// traceGraph controls the trace graph under trace page
traceGraph?: {
Copy link
Member

Choose a reason for hiding this comment

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

please move this above L157, I don't think this is "experimental"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved.

I originally put it below L157 because I thought it was "undocumented" in https://www.jaegertracing.io/docs/1.42/frontend-ui/

packages/jaeger-ui/src/constants/default-config.tsx Outdated Show resolved Hide resolved
@@ -435,6 +438,7 @@ export function mapStateToProps(state: ReduxState, ownProps: TOwnProps): TReduxP
const archiveEnabled = Boolean(config.archiveEnabled);
const { state: locationState } = router.location;
const searchUrl = (locationState && locationState.fromSearch) || null;
const graphLayoutManagerMemory = config.traceGraph?.layoutManagerMemory;
Copy link
Member

Choose a reason for hiding this comment

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

can we add a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test.
It is not possible to test any UI change with this option, so I just followed the existing tests to test the propagation from redux state to component properties.

@@ -82,6 +82,7 @@ type TReduxProps = {
searchUrl: null | string;
trace: FetchedTrace | TNil;
uiFind: string | TNil;
graphLayoutManagerMemory: number | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not an expect in React, so a Q: why does this setting need to be in the properties (which causes more code changes) instead of only passed from config to <TraceGraph>? Or even looked up from config by TraceGraph directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't worked on React for a while, so I might be wrong.

1>
I observed in this repo:

  • The config is passed into React components via Redux.
  • Only top/page level components (like TracePage in this example) subscribe to Redux, and most sub-components don't.

So I am trying to follow the same style here - have TracePage get config from redux and pass to TraceGraph via property.

2>
Since we let component TracePage subscribe to Redux, then we need to make sure what we need from Redux is exposed as component property by mapStateToProps function defined in the component.

We can either expose the entire config object, or sub fields/objects, but either requires code change - adding into component property definition.

The reason I exposed graphLayoutManagerMemory (now I changed to traceGraphConfig) instead of entire config object is due component re-render.
If any property value of the component changes, it causes component to re-render. The entire config object contains other fields/sub objects that current component doesn't need at all, which might cause unnecessary re-render.

Trace graph has a problem to renders large traces (with ~15K+ spans), and gives the error "Cannot enlarge memory arrays". Need to give users flexibility to control the totalMemory of LayoutManager used for TraceGraph.

Signed-off-by: Chen Xu <[email protected]>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

thanks

@yurishkuro yurishkuro enabled auto-merge (squash) March 13, 2023 23:39
@yurishkuro yurishkuro enabled auto-merge (squash) March 13, 2023 23:40
@ChenX1993
Copy link
Contributor Author

ChenX1993 commented Mar 14, 2023

The unit-tests check failed at Upload coverage to codecov.io step.
Error message:

['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
[2023-03-13T23:48:23.044Z] ['verbose'] The error stack is: Error: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
    at main (/snapshot/repo/dist/src/index.js)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Not very sure why.

@yurishkuro yurishkuro merged commit 947c145 into jaegertracing:main Mar 14, 2023
@yurishkuro
Copy link
Member

sometimes codecov hiccups, I reran the job and tests were fine.

Binrix pushed a commit to Binrix/jaeger-ui that referenced this pull request Apr 18, 2023
Trace graph has a problem to renders large traces (with ~15K+ spans),
and gives the error "Cannot enlarge memory arrays". Need to give users
flexibility to control the totalMemory of LayoutManager used for
TraceGraph.

<!--
Please delete this comment before posting.

We appreciate your contribution to the Jaeger project! 👋🎉

Before creating a pull request, please make sure:
- Your PR is solving one problem
- You have read the guide for contributing
- See
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING.md
- You signed all your commits (otherwise we won't be able to merge the
PR)
- See
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md#certificate-of-origin---sign-your-work
- You added unit tests for the new functionality
- You mention in the PR description which issue it is addressing, e.g.
"Resolves jaegertracing#123"
-->

- Resolves jaegertracing#1249

Trace graph has a problem to renders large traces (with ~15K+ spans),
and gives the error "Cannot enlarge memory arrays". This can be fixed by
providing a larger number of memory when initializing the
`LayoutManager` in trace graph, like below:
```
// default 16MB
this.layoutManager = new LayoutManager({ totalMemory: 33554432, useDotEdges: true, splines: 'polyline' });
```
But instead of hardcoding the memory value in code, we want to give
users the flexibility to control the totalMemory of LayoutManager for
TraceGraph.

Signed-off-by: Chen Xu <[email protected]>
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.

[Feature]: Adding Config for TotalMemory in LayoutManager for TraceGraph
2 participants