Skip to content

Commit

Permalink
Merge branch 'master' into service-tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Bulicek committed Nov 27, 2018
2 parents 3518b13 + 8d43a20 commit cdb75a9
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 44 deletions.
13 changes: 10 additions & 3 deletions src/components/traces/details/timeline/rawSpan.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import Error from '../../../common/error';
@observer
export default class RawSpan extends React.Component {
static propTypes = {
rawSpanStore: PropTypes.object.isRequired
rawSpanStore: PropTypes.object.isRequired,
duplicateSpanId: PropTypes.bool.isRequired
};

render() {
const {rawSpanStore} = this.props;
const {rawSpanStore, duplicateSpanId} = this.props;

return (
<div>
Expand All @@ -38,7 +39,13 @@ export default class RawSpan extends React.Component {
rejected: () => <Error />,
fulfilled: () => {
if (rawSpanStore.rawSpan) {
return <pre className="raw-span">{JSON.stringify(rawSpanStore.rawSpan, null, 2)}</pre>;
return (
<div>
{duplicateSpanId && <div>
<strong>Client and Server Span ID are identical - results may be incorrect. Check the raw trace for full span list.</strong>
</div>}
<pre className="raw-span">{JSON.stringify(rawSpanStore.rawSpan, null, 2)}</pre>
</div>);
}

return <Error errorMessage="There was a problem displaying the raw span. Please try again later."/>;
Expand Down
31 changes: 12 additions & 19 deletions src/components/traces/details/timeline/span.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default class Span extends React.Component {

// merged span indicator
const isMergedSpan = Span.getTagValue(span, auxillaryTags.IS_MERGED_SPAN);
const isAutoGenerated = Span.getTagValue(span, auxillaryTags.IS_AUTOGENERATED_SPAN);
const clientServiceName = Span.getTagValue(span, auxillaryTags.CLIENT_SERVICE_NAME);
const clientOperationName = Span.getTagValue(span, auxillaryTags.CLIENT_OPERATION_NAME);

Expand Down Expand Up @@ -256,25 +257,17 @@ export default class Span extends React.Component {
>{expanded ? '-' : '+'}</text>
</g>
: null }
{isMergedSpan ?
<SpanDetailsModal
isOpen={this.state.modalIsOpen}
closeModal={this.closeModal}
serviceName={serviceName}
span={span}
startTime={startTime}
clientServiceName={clientServiceName}
fullOperationName={fullOperationName}
clientSpanId={clientSpanId}
/> :
<SpanDetailsModal
isOpen={this.state.modalIsOpen}
closeModal={this.closeModal}
serviceName={serviceName}
span={span}
startTime={startTime}
/>
}
<SpanDetailsModal
isOpen={this.state.modalIsOpen}
closeModal={this.closeModal}
span={span}
startTime={startTime}
clientServiceName={clientServiceName}
fullOperationName={fullOperationName}
clientSpanId={clientSpanId}
isAutoGenerated={isAutoGenerated}
isMergedSpan={isMergedSpan}
/>
<clipPath id="overflow">
<rect
x="0"
Expand Down
46 changes: 26 additions & 20 deletions src/components/traces/details/timeline/spanDetailsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,33 @@ export default class SpanDetailsModal extends React.Component {
this.setState({tabSelected: tabIndex});
}
tabViewer(span) {
const duplicateSpanId = this.props.clientSpanId === this.props.span.spanId;

switch (this.state.tabSelected) {
case 1:
return <TagsTable tags={span.tags} />;
case 2:
return <LogsTable logs={span.logs} startTime={this.props.startTime} />;
case 3:
rawSpanStore.fetchRawSpan(span.traceId, span.spanId);
return <RawSpan rawSpanStore={rawSpanStore}/>;
return <RawSpan duplicateSpanId={duplicateSpanId} rawSpanStore={rawSpanStore}/>;
case 4:
rawSpanStore.fetchRawSpan(span.traceId, this.props.clientSpanId);
return <RawSpan rawSpanStore={rawSpanStore}/>;
return <RawSpan duplicateSpanId={duplicateSpanId} rawSpanStore={rawSpanStore}/>;
default:
return null;
}
}

render() {
const subsystems = window.haystackUiConfig.subsystems;
const title = this.props.fullOperationName ?
`Merged Span - ${this.props.fullOperationName}: ${formatters.toDurationString(this.props.span.duration)}` :
`${this.props.span.operationName}: ${formatters.toDurationString(this.props.span.duration)}`;

const operationTitle = `${this.props.fullOperationName}: ${formatters.toDurationString(this.props.span.duration)}`;
const fullTitle = this.props.isMergedSpan ? `Merged Span - ${operationTitle}` : operationTitle;
const serviceName = this.props.span.serviceName;
return (
<Modal
serviceName={this.props.serviceName}
title={title}
serviceName={serviceName}
title={fullTitle}
isOpen={this.props.isOpen}
closeModal={this.props.closeModal}
clientServiceName={this.props.clientServiceName}
Expand All @@ -76,20 +77,22 @@ export default class SpanDetailsModal extends React.Component {
<ul className="nav nav-tabs pull-left">
<li className={this.state.tabSelected === 1 ? 'active' : ''}>
<a role="button" tabIndex="-2" className="tags-tab" onClick={() => this.toggleTab(1)} >
{this.props.clientServiceName ? 'Merged Tags' : 'Tags'}
{this.props.isMergedSpan ? 'Merged Tags' : 'Tags'}
</a>
</li>
<li className={this.state.tabSelected === 2 ? 'active' : ''}>
<a role="button" className="log-tab" tabIndex="-1" onClick={() => this.toggleTab(2)} >
{this.props.clientServiceName ? 'Merged Logs' : 'Logs'}
{this.props.isMergedSpan ? 'Merged Logs' : 'Logs'}
</a>
</li>
<li className={this.state.tabSelected === 3 ? 'active' : ''}>
<a role="button" tabIndex="-3" className="raw-tab" onClick={() => this.toggleTab(3)} >
{this.props.clientServiceName ? 'Raw Server Span' : 'Raw Span'}
</a>
</li>
{ this.props.clientServiceName && (
{ !this.props.isAutoGenerated &&
<li className={this.state.tabSelected === 3 ? 'active' : ''}>
<a role="button" tabIndex="-3" className="raw-tab" onClick={() => this.toggleTab(3)}>
{this.props.isMergedSpan ? 'Raw Server Span' : 'Raw Span'}
</a>
</li>
}
{ this.props.isMergedSpan && (
<li className={this.state.tabSelected === 4 ? 'active' : ''}>
<a role="button" tabIndex="-4" className="raw-tab" onClick={() => this.toggleTab(4)} >Raw Client Span</a>
</li>
Expand All @@ -102,7 +105,7 @@ export default class SpanDetailsModal extends React.Component {
className="btn btn-primary"
to={
linkBuilder.universalSearchTrendsLink({
serviceName: this.props.serviceName,
serviceName,
operationName: this.props.span.operationName
})
}
Expand All @@ -120,16 +123,19 @@ export default class SpanDetailsModal extends React.Component {
SpanDetailsModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
closeModal: PropTypes.func.isRequired,
serviceName: PropTypes.string.isRequired,
span: PropTypes.object.isRequired,
startTime: PropTypes.number.isRequired,
clientServiceName: PropTypes.string,
fullOperationName: PropTypes.string,
clientSpanId: PropTypes.string
clientSpanId: PropTypes.string,
isAutoGenerated: PropTypes.bool,
isMergedSpan: PropTypes.bool
};

SpanDetailsModal.defaultProps = {
clientServiceName: null,
fullOperationName: null,
clientSpanId: null
clientSpanId: null,
isAutoGenerated: false,
isMergedSpan: false
};
3 changes: 2 additions & 1 deletion src/components/traces/utils/auxiliaryTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export default {
CLIENT_OPERATION_NAME: 'X-HAYSTACK-CLIENT-OPERATION-NAME',
CLIENT_START_TIME: 'X-HAYSTACK-CLIENT-START-TIME',
CLIENT_DURATION: 'X-HAYSTACK-CLIENT-DURATION',
CLIENT_SPAN_ID: 'X-HAYSTACK-CLIENT-SPAN-ID'
CLIENT_SPAN_ID: 'X-HAYSTACK-CLIENT-SPAN-ID',
IS_AUTOGENERATED_SPAN: 'X-HAYSTACK-AUTOGEN'
};

0 comments on commit cdb75a9

Please sign in to comment.