Skip to content

Commit

Permalink
misc PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffon committed Aug 8, 2017
1 parent 5f042f0 commit f1f7343
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
20 changes: 20 additions & 0 deletions src/model/order-by.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

export const MOST_RECENT = 'MOST_RECENT';
export const LONGEST_FIRST = 'LONGEST_FIRST';
export const SHORTEST_FIRST = 'SHORTEST_FIRST';
Expand Down
3 changes: 1 addition & 2 deletions src/model/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export function getTraceSummary(trace: Trace): TraceSummary {
// serviceName -> { name, numberOfSpans }
const serviceMap = {};

let i = 0;
for (; i < spans.length; i++) {
for (let i = 0; i < spans.length; i++) {
const { duration, processID, spanID, startTime, tags } = spans[i];
// time bounds of trace
minTs = minTs > startTime ? startTime : minTs;
Expand Down
45 changes: 43 additions & 2 deletions src/model/search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('getTraceSummary()', () => {
let summary;

beforeEach(() => {
trace = traceGenerator.trace({ numberOfSpans: 10 });
trace = traceGenerator.trace({ numberOfSpans: 2 });
summary = getTraceSummary(trace);
});

Expand All @@ -49,7 +49,48 @@ describe('getTraceSummary()', () => {
expect(getTraceSummary(trace).numberOfErredSpans).toBe(2);
});

xit('generates the traceName', () => {});
it('generates the traceName', () => {
trace = {
traceID: 'main-id',
spans: [
{
traceID: 'main-id',
processID: 'pid0',
spanID: 'main-id',
operationName: 'op0',
startTime: 1502221240933000,
duration: 236857,
tags: [],
},
{
traceID: 'main-id',
processID: 'pid1',
spanID: 'span-child',
operationName: 'op1',
startTime: 1502221241144382,
duration: 25305,
tags: [],
},
],
duration: 236857,
timestamp: 1502221240933000,
processes: {
pid0: {
processID: 'pid0',
serviceName: 'serviceA',
tags: [],
},
pid1: {
processID: 'pid1',
serviceName: 'serviceB',
tags: [],
},
},
};
const { traceName } = getTraceSummary(trace);
expect(traceName).toBe('serviceA: op0');
});

xit('derives services summations', () => {});
});

Expand Down
2 changes: 1 addition & 1 deletion src/reducers/trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function fetchTraceDone(state, { meta, payload }) {
}

function fetchTraceErred(state, { meta, payload }) {
const traces = Object.assign({}, state.traces, { [meta.id]: payload });
const traces = { ...state.traces, [meta.id]: payload };
return { ...state, traces, loading: false };
}

Expand Down

0 comments on commit f1f7343

Please sign in to comment.