-
Notifications
You must be signed in to change notification settings - Fork 488
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 view for showing detailed trace statistics #506
Changes from 4 commits
8124a95
b0f4837
fb08bd7
3b2c011
72aa762
bb39023
0841863
d6710ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,29 +16,62 @@ import * as React from 'react'; | |
import { Button, Dropdown, Icon, Menu } from 'antd'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { trackGanttView, trackGraphView, trackJsonView, trackRawJsonView } from './TracePageHeader.track'; | ||
import { | ||
trackGanttView, | ||
trackGraphView, | ||
trackStatisticsView, | ||
trackJsonView, | ||
trackRawJsonView, | ||
} from './TracePageHeader.track'; | ||
import prefixUrl from '../../../utils/prefix-url'; | ||
import { ETraceViewType } from '../types'; | ||
|
||
type Props = { | ||
onTraceGraphViewClicked: () => void; | ||
traceGraphView: boolean; | ||
onTraceViewChange: (actualViewType: ETraceViewType) => void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does "actual" mean here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
traceID: string; | ||
viewType: ETraceViewType; | ||
}; | ||
|
||
const menuItems = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
{ | ||
viewType: ETraceViewType.TraceTimelineViewer, | ||
label: 'Trace Timeline', | ||
}, | ||
{ | ||
viewType: ETraceViewType.TraceGraph, | ||
label: 'Trace Graph', | ||
}, | ||
{ | ||
viewType: ETraceViewType.TraceStatistics, | ||
label: 'Trace Statistics', | ||
}, | ||
]; | ||
|
||
export default function AltViewOptions(props: Props) { | ||
const { onTraceGraphViewClicked, traceGraphView, traceID } = props; | ||
const handleToggleView = () => { | ||
if (traceGraphView) trackGanttView(); | ||
else trackGraphView(); | ||
onTraceGraphViewClicked(); | ||
const { onTraceViewChange, viewType, traceID } = props; | ||
|
||
const handleToggleView = (item: ETraceViewType) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. toggle should be select There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
if (item === ETraceViewType.TraceTimelineViewer) { | ||
trackGanttView(); | ||
} else if (item === ETraceViewType.TraceGraph) { | ||
trackGraphView(); | ||
} else if (item === ETraceViewType.TraceStatistics) { | ||
trackStatisticsView(); | ||
} | ||
onTraceViewChange(item); | ||
}; | ||
|
||
const menu = ( | ||
<Menu> | ||
<Menu.Item> | ||
<a onClick={handleToggleView} role="button"> | ||
{traceGraphView ? 'Trace Timeline' : 'Trace Graph'} | ||
</a> | ||
</Menu.Item> | ||
{menuItems.map(item => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be clearer as:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
item.viewType === viewType ? null : ( | ||
<Menu.Item key={item.label}> | ||
<a onClick={() => handleToggleView(item.viewType)} role="button"> | ||
{item.label} | ||
</a> | ||
</Menu.Item> | ||
) | ||
)} | ||
<Menu.Item> | ||
<Link | ||
to={prefixUrl(`/api/traces/${traceID}?prettyPrint=true`)} | ||
|
@@ -61,10 +94,14 @@ export default function AltViewOptions(props: Props) { | |
</Menu.Item> | ||
</Menu> | ||
); | ||
|
||
return ( | ||
<Dropdown overlay={menu}> | ||
<Button className="ub-mr2" htmlType="button" onClick={handleToggleView}> | ||
Alternate Views <Icon type="down" /> | ||
<Button className="ub-mr2" htmlType="button"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be an action-less button, instead it should be a span. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
{menuItems.find(test => test.viewType === viewType) !== undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd calculate the
is clearer and better handles the (presumably impossible) case of an invalid current viewType. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
? menuItems.find(test => test.viewType === viewType)!.label | ||
: ''} | ||
<Icon type="down" /> | ||
</Button> | ||
</Dropdown> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import AltViewOptions from './AltViewOptions'; | |
import KeyboardShortcutsHelp from './KeyboardShortcutsHelp'; | ||
import SpanGraph from './SpanGraph'; | ||
import TracePageSearchBar from './TracePageSearchBar'; | ||
import { TUpdateViewRangeTimeFunction, IViewRange, ViewRangeTimeUpdate } from '../types'; | ||
import { TUpdateViewRangeTimeFunction, IViewRange, ViewRangeTimeUpdate, ETraceViewType } from '../types'; | ||
import LabeledList from '../../common/LabeledList'; | ||
import NewWindowIcon from '../../common/NewWindowIcon'; | ||
import TraceName from '../../common/TraceName'; | ||
|
@@ -49,7 +49,7 @@ type TracePageHeaderEmbedProps = { | |
nextResult: () => void; | ||
onArchiveClicked: () => void; | ||
onSlimViewClicked: () => void; | ||
onTraceGraphViewClicked: () => void; | ||
onTraceViewChange: (actualViewType: ETraceViewType) => void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, why actual? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
prevResult: () => void; | ||
resultCount: number; | ||
showArchiveButton: boolean; | ||
|
@@ -60,7 +60,7 @@ type TracePageHeaderEmbedProps = { | |
textFilter: string | TNil; | ||
toSearch: string | null; | ||
trace: Trace; | ||
traceGraphView: boolean; | ||
viewType: ETraceViewType; | ||
updateNextViewRangeTime: (update: ViewRangeTimeUpdate) => void; | ||
updateViewRangeTime: TUpdateViewRangeTimeFunction; | ||
viewRange: IViewRange; | ||
|
@@ -117,7 +117,7 @@ export function TracePageHeaderFn(props: TracePageHeaderEmbedProps & { forwarded | |
nextResult, | ||
onArchiveClicked, | ||
onSlimViewClicked, | ||
onTraceGraphViewClicked, | ||
onTraceViewChange, | ||
prevResult, | ||
resultCount, | ||
showArchiveButton, | ||
|
@@ -128,7 +128,7 @@ export function TracePageHeaderFn(props: TracePageHeaderEmbedProps & { forwarded | |
textFilter, | ||
toSearch, | ||
trace, | ||
traceGraphView, | ||
viewType, | ||
updateNextViewRangeTime, | ||
updateViewRangeTime, | ||
viewRange, | ||
|
@@ -187,15 +187,11 @@ export function TracePageHeaderFn(props: TracePageHeaderEmbedProps & { forwarded | |
ref={forwardedRef} | ||
resultCount={resultCount} | ||
textFilter={textFilter} | ||
navigable={!traceGraphView} | ||
navigable={viewType === ETraceViewType.TraceTimelineViewer} | ||
/> | ||
{showShortcutsHelp && <KeyboardShortcutsHelp className="ub-m2" />} | ||
{showViewOptions && ( | ||
<AltViewOptions | ||
onTraceGraphViewClicked={onTraceGraphViewClicked} | ||
traceGraphView={traceGraphView} | ||
traceID={trace.traceID} | ||
/> | ||
<AltViewOptions onTraceViewChange={onTraceViewChange} traceID={trace.traceID} viewType={viewType} /> | ||
)} | ||
{showArchiveButton && ( | ||
<Button className="ub-mr2 ub-flex ub-items-center" htmlType="button" onClick={onArchiveClicked}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Copyright (c) 2018 The Jaeger Authors. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please update to 2020 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.DetailTableData--tr { | ||
border-top: 1px solid #ececec; | ||
} | ||
|
||
.DetailTableData--tr:hover { | ||
background: #fafafa; | ||
color: black; | ||
} | ||
|
||
.DetailTableData--child--td { | ||
border-left: 1px solid rgb(204, 204, 204); | ||
border-right: 1px solid rgb(204, 204, 204); | ||
border-top: 1px solid rgb(230, 230, 230); | ||
border-bottom: 1px solid rgb(230, 230, 230); | ||
width: 10%; | ||
padding-left: 2em; | ||
|
||
max-width: 25em; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
.DetailTableData--serviceBorder { | ||
border-left: 4px solid transparent; | ||
padding-left: 0.6em; | ||
} | ||
|
||
.DetailTableData--td { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DRY this and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
border-left: 1px solid rgb(204, 204, 204); | ||
border-right: 1px solid rgb(204, 204, 204); | ||
border-top: 1px solid rgb(230, 230, 230); | ||
border-bottom: 1px solid rgb(230, 230, 230); | ||
width: 9.09%; | ||
padding-left: 2em; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} |
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.
due to the increase in views, this test is getting slightly out of hand. I would rework it as follows: