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

added function to show full traceID in #2536

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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 @@ -35,6 +35,7 @@ describe('<TracePageHeader>', () => {
showViewOptions: false,
textFilter: '',
updateTextFilter: () => {},
traceIDLength: 7,
};

let wrapper;
Expand Down Expand Up @@ -132,4 +133,16 @@ describe('<TracePageHeader>', () => {
expect(wrapper.find({ to: linkToStandalone }).length).toBe(0);
});
});

it('renders trace ID with correct length', () => {
const testTrace = {
...trace,
traceID: '1234567890abcdef',
};
wrapper.setProps({
trace: testTrace,
traceIDLength: 7,
});
expect(wrapper.find('.u-tx-muted').text()).toHaveLength(7);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { getTraceLinks } from '../../../model/link-patterns';
import './TracePageHeader.css';
import ExternalLinks from '../../common/ExternalLinks';
import { getTargetEmptyOrBlank } from '../../../utils/config/get-target';
import { getConfigValue } from '../../../utils/config/get-config';

type TracePageHeaderEmbedProps = {
canCollapse: boolean;
Expand Down Expand Up @@ -149,7 +150,8 @@ export function TracePageHeaderFn(props: TracePageHeaderEmbedProps & { forwarded
return { ...rest, value: renderer(trace) };
});

const traceShortID = trace.traceID.slice(0, 7);
const traceIDLength = getConfigValue('traceIDLength');
const traceShortID = trace.traceID.slice(0, traceIDLength);

const title = (
<h1 className={`TracePageHeader--title ${canCollapse ? 'is-collapsible' : ''}`}>
Expand Down
1 change: 1 addition & 0 deletions packages/jaeger-ui/src/constants/default-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const defaultConfig: Config = {
},
maxLimit: 1500,
},
traceIDLength: 7,
storageCapabilities: {
archiveStorage: false,
},
Expand Down
3 changes: 3 additions & 0 deletions packages/jaeger-ui/src/types/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export type Config = {
// TODO when is it useful?
scripts?: readonly TScript[];

// traceIDLength controls the length of the trace ID displayed in the UI.
traceIDLength?: number;

// storage capabilities given by the query service.
storageCapabilities?: StorageCapabilities;

Expand Down
Loading