This repository has been archived by the owner on Sep 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swap metrics and query columns (#12)
* tracer package * configure package and webpack for distribution * separate logEntry and formatEntry; send entry to elastic * shallow copy elastic.Client options because elastic/elasticsearch-js#33 * add API docs to readme * adjust readme * Update README.md * configure frontend to work with trace data in elasticsearch * add circleci config * Update README.md * move elastic call to componentDidMount * move jest.json to root and only call test once in circle * remove fast-async * run packages/tracer/yarn install in circle * try different syntax for circle deps * Add basic functional analytics frontend * Remove superfluous curly braces from App.js * Swap metrics and query columns
- Loading branch information
Showing
10 changed files
with
129 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
import React from 'react' | ||
import Button from '../Button/Button' | ||
import { withRouter } from 'react-router' | ||
|
||
import vars from '../../styles/vars' | ||
|
||
const style = { | ||
const buttonStyle = { | ||
fontFamily: vars.fontFamily, | ||
} | ||
|
||
export default ({ trace }) => ( | ||
<dl style={style}> | ||
<dt>Duration</dt> | ||
<dd>{parseInt(trace._source.metrics.duration / 10 ** 6)} ms</dd> | ||
</dl> | ||
const Metrics = ({ trace, isActive, history }) => ( | ||
<Button | ||
style={buttonStyle} | ||
isActive={isActive} | ||
onClick={() => | ||
history.push(`/aggregations/${trace._source.rootQuery}/${trace._id}`) | ||
} | ||
> | ||
<span style={{ flexGrow: 1 }}>{trace._source.rootQuery}</span> | ||
<span>{parseInt(trace._source.metrics.duration / 10 ** 6)} ms</span> | ||
</Button> | ||
) | ||
|
||
export default withRouter(Metrics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React from 'react' | ||
import Metrics from './Metrics' | ||
import renderer from 'react-test-renderer' | ||
import { renderWithRouter } from '../../__tests__/helpers' | ||
|
||
it('renders correctly', () => { | ||
const data = { | ||
_source: { | ||
metrics: { duration: 1 }, | ||
}, | ||
} | ||
const tree = renderer.create(<Metrics trace={data} />).toJSON() | ||
const tree = renderWithRouter({ children: <Metrics trace={data} /> }) | ||
expect(tree).toMatchSnapshot() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders correctly 1`] = ` | ||
<dl | ||
<div | ||
className="button" | ||
onClick={[Function]} | ||
style={ | ||
Object { | ||
"fontFamily": "sans-serif", | ||
} | ||
} | ||
> | ||
<dt> | ||
Duration | ||
</dt> | ||
<dd> | ||
<span | ||
style={ | ||
Object { | ||
"flexGrow": 1, | ||
} | ||
} | ||
/> | ||
<span> | ||
0 | ||
ms | ||
</dd> | ||
</dl> | ||
</span> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,16 @@ | ||
import React from 'react' | ||
import { withRouter } from 'react-router' | ||
import Button from '../Button/Button' | ||
|
||
const codeStyle = { | ||
fontFamily: 'monospace', | ||
whiteSpace: 'pre', | ||
backgroundColor: 'rgba(248, 248, 255, 1)', | ||
overflowX: 'auto', | ||
width: '100%', | ||
} | ||
|
||
const buttonStyle = { | ||
marginBottom: '20px', | ||
} | ||
|
||
const Query = ({ query, history, location, isActive }) => ( | ||
<Button | ||
style={buttonStyle} | ||
isActive={isActive} | ||
onClick={() => history.push(`${location.pathname}/${query._id}`)} | ||
> | ||
<div style={codeStyle}>{query._source.graphql}</div> | ||
</Button> | ||
<div style={codeStyle}>{query._source.graphql}</div> | ||
) | ||
|
||
export default withRouter(Query) | ||
export default Query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters