Skip to content

Commit

Permalink
Add View Option for raw/unadjusted trace (#153)
Browse files Browse the repository at this point in the history
* Add View Option for raw/unadjusted trace

Signed-off-by: Yuri Shkuro <ys@uber.com>

* Remove /

Signed-off-by: Yuri Shkuro <ys@uber.com>

* Add missing prefixUrl adjustment

Signed-off-by: Joe Farro <joef@uber.com>

* Fix failing unit test

Signed-off-by: Joe Farro <joef@uber.com>
  • Loading branch information
yurishkuro authored and tiffon committed Dec 24, 2017
1 parent 8d673fa commit 0e00d93
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/components/SearchTracePage/TraceSearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ export function convertQueryParamsToFormDates({ start, end }) {
let queryEndDate;
let queryEndDateTime;
if (end) {
const endUnix = moment(parseInt(end.replace('000', ''), 10));
queryEndDate = formatDate(endUnix * 1000);
queryEndDateTime = formatTime(endUnix * 1000);
const endUnixNs = parseInt(end, 10);
queryEndDate = formatDate(endUnixNs);
queryEndDateTime = formatTime(endUnixNs);
}
if (start) {
const startUnix = moment(parseInt(start.replace('000', ''), 10));
queryStartDate = formatDate(startUnix * 1000);
queryStartDateTime = formatTime(startUnix * 1000);
const startUnixNs = parseInt(start, 10);
queryStartDate = formatDate(startUnixNs);
queryStartDateTime = formatTime(startUnixNs);
}

return {
Expand Down
14 changes: 12 additions & 2 deletions src/components/TracePage/TracePageHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Dropdown, Menu } from 'semantic-ui-react';
import KeyboardShortcutsHelp from './KeyboardShortcutsHelp';
import { FALLBACK_TRACE_NAME } from '../../constants';
import { formatDatetime, formatDuration } from '../../utils/date';
import prefixUrl from '../../utils/prefix-url';

type TracePageHeaderProps = {
traceID: string,
Expand Down Expand Up @@ -103,8 +104,17 @@ export default function TracePageHeader(props: TracePageHeaderProps) {
<Dropdown text="View Options" className="item">
<Dropdown.Menu>
<Dropdown.Item>
<a rel="noopener noreferrer" target="_blank" href={`/api/traces/${traceID}`}>
View Trace JSON
<a rel="noopener noreferrer" target="_blank" href={prefixUrl(`/api/traces/${traceID}`)}>
Trace JSON
</a>
</Dropdown.Item>
<Dropdown.Item>
<a
rel="noopener noreferrer"
target="_blank"
href={prefixUrl(`/api/traces/${traceID}?raw=true`)}
>
Trace JSON (unadjusted)
</a>
</Dropdown.Item>
</Dropdown.Menu>
Expand Down

0 comments on commit 0e00d93

Please sign in to comment.