Skip to content

Commit

Permalink
Add totalMemory in config for trace graph
Browse files Browse the repository at this point in the history
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 <chen.x@uber.com>
  • Loading branch information
ChenX1993 committed Mar 13, 2023
1 parent 80442b8 commit 8faa70d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Props = {
ev?: TEv | TNil;
uiFind: string | TNil;
uiFindVertexKeys: Set<string> | TNil;
layoutManagerMemory?: number | undefined;
};
type State = {
showHelp: boolean;
Expand Down Expand Up @@ -129,7 +130,11 @@ export default class TraceGraph extends React.PureComponent<Props, State> {
showHelp: false,
mode: MODE_SERVICE,
};
this.layoutManager = new LayoutManager({ useDotEdges: true, splines: 'polyline' });
this.layoutManager = new LayoutManager({
totalMemory: props.layoutManagerMemory,
useDotEdges: true,
splines: 'polyline',
});
}

componentWillUnmount() {
Expand Down
5 changes: 5 additions & 0 deletions packages/jaeger-ui/src/components/TracePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type TReduxProps = {
searchUrl: null | string;
trace: FetchedTrace | TNil;
uiFind: string | TNil;
graphLayoutManagerMemory: number | undefined;
};

type TProps = TDispatchProps & TOwnProps & TReduxProps;
Expand Down Expand Up @@ -326,6 +327,7 @@ export class TracePageImpl extends React.PureComponent<TProps, TState> {
id,
uiFind,
trace,
graphLayoutManagerMemory,
location: { state: locationState },
} = this.props;
const { slimView, viewType, headerHeight, viewRange } = this.state;
Expand Down Expand Up @@ -401,6 +403,7 @@ export class TracePageImpl extends React.PureComponent<TProps, TState> {
ev={this.traceDagEV}
uiFind={uiFind}
uiFindVertexKeys={graphFindMatches}
layoutManagerMemory={graphLayoutManagerMemory}
/>
);
} else if (ETraceViewType.TraceStatistics === viewType && headerHeight) {
Expand Down Expand Up @@ -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;

return {
...extractUiFindFromState(state),
Expand All @@ -444,6 +448,7 @@ export function mapStateToProps(state: ReduxState, ownProps: TOwnProps): TReduxP
id,
searchUrl,
trace,
graphLayoutManagerMemory,
};
}

Expand Down
3 changes: 3 additions & 0 deletions packages/jaeger-ui/src/constants/default-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ const defaultConfig: Config = {
menuEnabled: false,
menuLabel: 'Trace Quality',
},
traceGraph: {
layoutManagerMemory: undefined,
},
};

// Fields that should be merged with user-supplied config values rather than overwritten.
Expand Down
10 changes: 10 additions & 0 deletions packages/jaeger-ui/src/types/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,14 @@ export type Config = {
menuEnabled?: boolean;
menuLabel?: string;
};

// traceGraph controls the trace graph under trace page
traceGraph?: {
// layoutManagerMemory controls the total memeory available for the GraphViz
// Emscripten module instance. The value should be a power of two.
// The default of 16MB should be sufficient for most cases — only consider
// using a larger number if you run into the error "Cannot enlarge memory arrays".
// See https://github.com/jaegertracing/jaeger-ui/issues/1249 for background
layoutManagerMemory?: number;
};
};

0 comments on commit 8faa70d

Please sign in to comment.