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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { TEv, TSumSpan } from './types';
import { TDenseSpanMembers } from '../../../model/trace-dag/types';
import TDagPlexusVertex from '../../../model/trace-dag/types/TDagPlexusVertex';
import { TNil } from '../../../types';
import { TraceGraphConfig } from '../../../types/config';

import './TraceGraph.css';

Expand All @@ -39,6 +40,7 @@ type Props = {
ev?: TEv | TNil;
uiFind: string | TNil;
uiFindVertexKeys: Set<string> | TNil;
traceGraphConfig?: TraceGraphConfig;
};
type State = {
showHelp: boolean;
Expand Down Expand Up @@ -129,7 +131,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.traceGraphConfig?.layoutManagerMemory,
useDotEdges: true,
splines: 'polyline',
});
}

componentWillUnmount() {
Expand Down
16 changes: 16 additions & 0 deletions packages/jaeger-ui/src/components/TracePage/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,4 +793,20 @@ describe('mapStateToProps()', () => {
trace: { data: {}, state: fetchedState.DONE },
});
});

it('propagates layoutManagerMemory correctly', () => {
const fakeMemory = 123;
state.config.traceGraph = { layoutManagerMemory: fakeMemory };
const props = mapStateToProps(state, ownProps);
expect(props).toEqual({
id: traceID,
embedded,
archiveEnabled: false,
archiveTraceState: undefined,
searchUrl: null,
uiFind: undefined,
trace: { data: {}, state: fetchedState.DONE },
traceGraphConfig: { layoutManagerMemory: fakeMemory },
});
});
});
6 changes: 6 additions & 0 deletions packages/jaeger-ui/src/components/TracePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import updateUiFind from '../../utils/update-ui-find';
import TraceStatistics from './TraceStatistics/index';
import TraceSpanView from './TraceSpanView/index';
import TraceFlamegraph from './TraceFlamegraph/index';
import { TraceGraphConfig } from '../../types/config';

import './index.css';

Expand All @@ -82,6 +83,7 @@ type TReduxProps = {
searchUrl: null | string;
trace: FetchedTrace | TNil;
uiFind: string | TNil;
traceGraphConfig?: TraceGraphConfig;
};

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

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

Expand Down
5 changes: 5 additions & 0 deletions packages/jaeger-ui/src/constants/default-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ const defaultConfig: Config = {
},
docsLink: 'https://www.jaegertracing.io/docs/latest/spm/',
},

traceGraph: {
layoutManagerMemory: undefined,
},

deepDependencies: {
menuEnabled: false,
},
Expand Down
12 changes: 12 additions & 0 deletions packages/jaeger-ui/src/types/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ export type MonitorConfig = {
docsLink?: string;
};

export type TraceGraphConfig = {
// 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;
};

// Default values are provided in packages/jaeger-ui/src/constants/default-config.tsx
export type Config = {
// archiveEnabled enables the Archive Trace button in the trace view.
Expand Down Expand Up @@ -154,6 +163,9 @@ export type Config = {
// monitor section controls Service Performance Monitoring tab.
monitor?: MonitorConfig;

// traceGraph controls the trace graph under trace page
traceGraph?: TraceGraphConfig;

// The following features are experimental / undocumented.

deepDependencies?: {
Expand Down