Skip to content

Commit

Permalink
Handle Error stored in redux trace.traces (jaegertracing#195)
Browse files Browse the repository at this point in the history
* Fix 166 - Handle Error objs in redux trace.traces

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

* Filter for Error objs one level higher

Filter in getTraceSummaries instead of further upstream because the presence of the Error will be useful in resolving #51.

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

Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
  • Loading branch information
tiffon committed Mar 13, 2018
1 parent 8b1ddda commit 9086467
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/model/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ export function getTraceSummary(trace: Trace): TraceSummary {
/**
* Transforms `Trace` values into `TraceSummary` values and finds the max duration of the traces.
*
* @param {Trace} _traces The trace data in the format from the HTTP request.
* @param {(Trace | Error)[]} _traces The trace data in the format from the HTTP request.
* @return {TraceSummaries} The `{ traces, maxDuration }` value.
*/
export function getTraceSummaries(_traces: Trace[]): TraceSummaries {
const traces = _traces.map(getTraceSummary);
export function getTraceSummaries(_traces: (Trace | Error)[]): TraceSummaries {
const traces = _traces
.map(item => {
if (item instanceof Error) {
return null;
}
return getTraceSummary(item);
})
.filter(Boolean);
const maxDuration = Math.max(..._map(traces, 'duration'));
return { maxDuration, traces };
}
Expand Down

0 comments on commit 9086467

Please sign in to comment.