Skip to content

Commit 9086467

Browse files
authored
Handle Error stored in redux trace.traces (jaegertracing#195)
* 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>
1 parent 8b1ddda commit 9086467

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/model/search.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,18 @@ export function getTraceSummary(trace: Trace): TraceSummary {
7979
/**
8080
* Transforms `Trace` values into `TraceSummary` values and finds the max duration of the traces.
8181
*
82-
* @param {Trace} _traces The trace data in the format from the HTTP request.
82+
* @param {(Trace | Error)[]} _traces The trace data in the format from the HTTP request.
8383
* @return {TraceSummaries} The `{ traces, maxDuration }` value.
8484
*/
85-
export function getTraceSummaries(_traces: Trace[]): TraceSummaries {
86-
const traces = _traces.map(getTraceSummary);
85+
export function getTraceSummaries(_traces: (Trace | Error)[]): TraceSummaries {
86+
const traces = _traces
87+
.map(item => {
88+
if (item instanceof Error) {
89+
return null;
90+
}
91+
return getTraceSummary(item);
92+
})
93+
.filter(Boolean);
8794
const maxDuration = Math.max(..._map(traces, 'duration'));
8895
return { maxDuration, traces };
8996
}

0 commit comments

Comments
 (0)