-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Redesign Trace Timeline #2736
Redesign Trace Timeline #2736
Changes from 28 commits
2ec84f2
3f690f3
69dfa0e
b3eda10
29b05c4
8a4b9ca
efbeaaa
8b7fbc1
ee9b960
f1f7f40
7b21001
4f489d2
63e61f9
78c58f8
ddef53c
ebba749
78c4592
ac75314
6f85c03
304d0a9
0d2bcdb
09c3aa6
11ff7fc
a4ce2f8
0e35170
767b44a
22b17f9
81c96ba
27f67c7
57ace80
f7b9b26
6574c50
bef72be
c628591
afb46ea
fb9fe8b
f6009e3
54caf11
a9491dc
57941de
883aec2
917f282
befe92d
608428f
cf7c14b
5df8b9e
6775b9e
b92fb1a
61f3cd3
5543f4b
1d7773c
6a5b1f7
61b38cc
2fea74e
d8a4cef
b6be6f3
e7f292c
c768196
69993bb
1549eb8
78c4613
1289126
1ba74b7
4b1fb78
ead555f
feddb37
ad08176
d8c1bf6
fb33ab2
0870e4c
fe8c791
09b04e6
7e355cb
6acd0f8
7360d82
226a3f6
871f41d
90edc6f
0c608fe
bd6fa74
8c843eb
d4298d6
fc6723a
6d38ebf
13ebb34
8540b20
3848bb1
7452dfe
bb9e746
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,10 +67,8 @@ const useStyles = makeStyles(theme => ({ | |
minHeight: '2rem', | ||
}, | ||
contentPaper: { | ||
flex: '0 1 100%', | ||
marginTop: '1.5rem', | ||
marginBottom: '1rem', | ||
overflow: 'auto', | ||
width: '100%', | ||
height: '100%', | ||
}, | ||
})); | ||
|
||
|
@@ -266,37 +264,47 @@ const DiscoverPage = ({ history, location }) => { | |
|
||
return ( | ||
<React.Fragment> | ||
<Box width="100%" display="flex" justifyContent="space-between"> | ||
<Box display="flex" alignItems="center"> | ||
<Typography variant="h5"> | ||
Discover | ||
</Typography> | ||
</Box> | ||
<Box pr={4} display="flex" alignItems="center"> | ||
<TraceJsonUploader /> | ||
<TraceIdSearchInput /> | ||
<Box pl={3} pr={3}> | ||
<Box width="100%" display="flex" justifyContent="space-between"> | ||
<Box display="flex" alignItems="center"> | ||
<Typography variant="h5"> | ||
Discover | ||
</Typography> | ||
</Box> | ||
<Box pr={3} display="flex" alignItems="center"> | ||
<TraceJsonUploader /> | ||
<TraceIdSearchInput /> | ||
</Box> | ||
</Box> | ||
<GlobalSearch findData={findData} /> | ||
</Box> | ||
<GlobalSearch findData={findData} /> | ||
<Paper className={classes.contentPaper}> | ||
<Box overflow="auto" width="100%" height="100%"> | ||
<AppBar position="static"> | ||
<Tabs | ||
value={tabValue} | ||
onChange={handleTabChange} | ||
className={classes.tabs} | ||
> | ||
<Tab label="Traces" className={classes.tab} /> | ||
<Tab label="Dependencies" className={classes.tab} /> | ||
</Tabs> | ||
</AppBar> | ||
{ /* 2rem is the height of the Appbar. */} | ||
<Box height="calc(100% - 2rem)"> | ||
{tabValue === tracesTab && <TracesTab />} | ||
{tabValue === dependenciesTab && <DependenciesTab />} | ||
<Box | ||
flex="0 1 100%" | ||
marginTop={1.5} | ||
marginBottom={1} | ||
marginRight={3} | ||
marginLeft={3} | ||
> | ||
<Paper className={classes.contentPaper}> | ||
<Box overflow="auto" width="100%" height="100%"> | ||
<AppBar position="static"> | ||
<Tabs | ||
value={tabValue} | ||
onChange={handleTabChange} | ||
className={classes.tabs} | ||
> | ||
<Tab label="Traces" className={classes.tab} /> | ||
<Tab label="Dependencies" className={classes.tab} /> | ||
</Tabs> | ||
</AppBar> | ||
{ /* 2rem is the height of the Appbar. */} | ||
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. Can we extract a constant for the height of app bar and then we don't even need a comment? |
||
<Box height="calc(100% - 2rem)"> | ||
{tabValue === tracesTab && <TracesTab />} | ||
{tabValue === dependenciesTab && <DependenciesTab />} | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Paper> | ||
</Paper> | ||
</Box> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright 2015-2019 The OpenZipkin Authors | ||
* | ||
* 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. | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import moment from 'moment'; | ||
import { withStyles } from '@material-ui/styles'; | ||
import Box from '@material-ui/core/Box'; | ||
import Table from '@material-ui/core/Table'; | ||
import TableBody from '@material-ui/core/TableBody'; | ||
import TableCell from '@material-ui/core/TableCell'; | ||
import TableRow from '@material-ui/core/TableRow'; | ||
import Paper from '@material-ui/core/Paper'; | ||
|
||
import { spanAnnotationPropTypes } from '../../../prop-types'; | ||
|
||
const propTypes = { | ||
annotation: spanAnnotationPropTypes.isRequired, | ||
classes: PropTypes.shape({}).isRequired, | ||
}; | ||
|
||
const style = { | ||
cell: { | ||
paddingTop: '8px', | ||
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. Hi! Curious, isn't it better to use Makes it easier for global customization as well if there needs to be a global padding change in the future. |
||
paddingBottom: '8px', | ||
}, | ||
}; | ||
|
||
const SpanAnnotation = ({ annotation, classes }) => ( | ||
<Box> | ||
<Box fontSize="1.1rem" mb={0.5}> | ||
{annotation.value} | ||
</Box> | ||
<Paper> | ||
<Table> | ||
<TableBody data-testid="span-annotation--table-body"> | ||
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. Probably not this PR, but it'd be good to strip these with https://www.npmjs.com/package/babel-plugin-react-remove-properties zipkin UI has tons of DOM, so these extra attributes look like they can have significant enough impact on performance compared to other apps. |
||
{ | ||
[ | ||
{ | ||
label: 'Start Time', | ||
// moment.js only supports millisecond precision, however our timestamps have | ||
// microsecond precision. So we use moment.js to generate the human readable time | ||
// with just milliseconds and then append the last 3 digits of the timestamp | ||
// which are the microseconds. | ||
// NOTE: a.timestamp % 1000 would save a string conversion but drops | ||
// leading zeros. | ||
value: moment(annotation.timestamp / 1000).format('MM/DD HH:mm:ss.SSS') | ||
+ annotation.timestamp.toString().slice(-3), | ||
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 guess the result of this would be something like I believe it's common in several programming languages and is coming to JS too: https://github.com/tc39/proposal-numeric-separator#references 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. Also I think it would be useful to extract this functionalitity to something like a global util of this package? (especially for its comment) 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. Thank you for your advice! |
||
}, | ||
{ label: 'Relative Time', value: annotation.relativeTime }, | ||
{ label: 'Address', value: annotation.endpoint }, | ||
].map(e => ( | ||
<TableRow key={e.label}> | ||
<TableCell className={classes.cell} data-testid="span-annotation--label"> | ||
{e.label} | ||
</TableCell> | ||
<TableCell className={classes.cell} data-testid="span-annotation--value"> | ||
{e.value} | ||
</TableCell> | ||
</TableRow> | ||
)) | ||
} | ||
</TableBody> | ||
</Table> | ||
</Paper> | ||
</Box> | ||
); | ||
|
||
SpanAnnotation.propTypes = propTypes; | ||
|
||
export default withStyles(style)(SpanAnnotation); | ||
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. Also how about adding 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. That's a nice improvement! I'm guessing there might be other good places like each individual trace (make sure not to rerender when expanding a trace) - but often it's just simplest to reason about to use
But will leave it to you how much you add it :) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2015-2019 The OpenZipkin Authors | ||
* | ||
* 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. | ||
*/ | ||
import React from 'react'; | ||
import { createShallow } from '@material-ui/core/test-utils'; | ||
|
||
import SpanAnnotation from './SpanAnnotation'; | ||
|
||
describe('<SpanAnnotation />', () => { | ||
let shallow; | ||
|
||
beforeEach(() => { | ||
shallow = createShallow(); | ||
}); | ||
|
||
it('should render annotation data', () => { | ||
const wrapper = shallow( | ||
<SpanAnnotation.Naked | ||
annotation={{ | ||
value: 'Server Start', | ||
timestamp: 1543334627716006, // 11/28 01:03:47.716006 | ||
relativeTime: '700ms', | ||
endpoint: '127.0.0.1', | ||
}} | ||
classes={{}} | ||
/>, | ||
); | ||
const rows = wrapper.find('[data-testid="span-annotation--table-body"]'); | ||
expect(rows.childAt(0).find('[data-testid="span-annotation--label"]').text()).toBe('Start Time'); | ||
expect(rows.childAt(0).find('[data-testid="span-annotation--value"]').text()).toBe('11/28 01:03:47.716006'); | ||
expect(rows.childAt(1).find('[data-testid="span-annotation--label"]').text()).toBe('Relative Time'); | ||
expect(rows.childAt(1).find('[data-testid="span-annotation--value"]').text()).toBe('700ms'); | ||
expect(rows.childAt(2).find('[data-testid="span-annotation--label"]').text()).toBe('Address'); | ||
expect(rows.childAt(2).find('[data-testid="span-annotation--value"]').text()).toBe('127.0.0.1'); | ||
}); | ||
}); |
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.
First time looking at lens code :)
Out of curiosity, have you thought about using
Grid
? Maybe it makes this sort of layout simpler.