From 5bddd3dc86e0755326ea9dca2140fc8ec002799f Mon Sep 17 00:00:00 2001 From: Ruben Vargas Date: Mon, 21 Oct 2019 18:12:46 -0500 Subject: [PATCH] Visualize multiple parent span Signed-off-by: Ruben Vargas --- .../TraceTimelineViewer/MultiParentIcon.tsx | 117 ++++++++++++++++++ .../TraceTimelineViewer/SpanBarRow.tsx | 8 +- .../TraceTimelineViewer/SpanDetail/index.tsx | 21 ++-- .../TraceTimelineViewer/SpanDetailRow.tsx | 19 +-- .../VirtualizedTraceView.tsx | 25 ++-- .../TraceTimelineViewer/duck.track.tsx | 18 +-- .../TracePage/TraceTimelineViewer/duck.tsx | 71 ++++++----- .../src/model/transform-trace-data.tsx | 18 ++- packages/jaeger-ui/src/selectors/trace.js | 66 ++++++++-- packages/jaeger-ui/src/types/trace.tsx | 22 ++-- packages/jaeger-ui/src/utils/TreeNode.js | 21 ++++ packages/jaeger-ui/src/utils/filter-spans.tsx | 2 +- .../jaeger-ui/src/utils/span-ancestor-ids.tsx | 19 +-- 13 files changed, 311 insertions(+), 116 deletions(-) create mode 100644 packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx diff --git a/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx new file mode 100644 index 0000000000..2ef3b7cc5c --- /dev/null +++ b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx @@ -0,0 +1,117 @@ +// Copyright (c) 2019 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import * as React from 'react'; +import { Button, Dropdown, Menu, Tooltip } from 'antd'; +import { bindActionCreators } from 'redux'; +import { connect, Dispatch } from 'react-redux'; +import { History as RouterHistory, Location } from 'history'; +import { withRouter } from 'react-router-dom'; + +import { FetchedTrace, ReduxState, TNil } from '../../../types'; +import { actions as timelineActions } from './duck'; +import { extractUiFindFromState } from '../../common/UiFindInput'; +import { SpanReference, Trace } from '../../../types/trace'; +import updateUiFind from '../../../utils/update-ui-find'; + +type TDispatchProps = { + focusUiFindMatches: (trace: Trace, uiFind: string | TNil) => void; +}; + +type TReduxProps = { + uiFind: string | TNil; + trace: FetchedTrace | TNil; +}; + +type TOwnProps = { + references: SpanReference[]; + traceID: string; + history: RouterHistory; + location: Location; + match: any; +}; + +type MultiParentIconProps = TDispatchProps & TReduxProps & TOwnProps; + +const linkValueList = (links: SpanReference[], focusUiFindMatches: (spanID: string) => void) => ( + + {links.map(({ spanID, span }, index) => { + let text = spanID; + if (span) { + text = `${span.operationName} (${spanID})`; + } + return ( + // `index` is necessary in the key because url can repeat + // eslint-disable-next-line react/no-array-index-key + + focusUiFindMatches(spanID)}> + {' '} + {text}{' '} + + + ); + })} + +); + +class MultiParentIconImpl extends React.PureComponent { + focusUiFindMatches = (uiFind: string) => { + const { trace, focusUiFindMatches, location, history } = this.props; + if (trace && trace.data) { + updateUiFind({ + location, + history, + uiFind, + }); + focusUiFindMatches(trace.data, uiFind); + } + }; + + render() { + const { references } = this.props; + return ( + + +