Skip to content

Commit

Permalink
Merge 8fbd6c3 into 2a353a1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Bulicek committed Mar 12, 2019
2 parents 2a353a1 + 8fbd6c3 commit d557cbe
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/components/alerts/details/alertDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default class AlertDetails extends React.Component {
type={this.props.type}
alertDetailsStore={this.props.alertDetailsStore}
historyWindow={AlertDetails.historyWindow}
interval={this.props.interval}
/>)
})
}
Expand Down
14 changes: 8 additions & 6 deletions src/components/alerts/details/alertDetailsToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const tracesEnabled = window.haystackUiConfig.subsystems.includes('traces');
export default class AlertDetailsToolbar extends React.Component {
static propTypes = {
serviceName: PropTypes.string.isRequired,
operationName: PropTypes.string.isRequired
operationName: PropTypes.string.isRequired,
interval: PropTypes.string.isRequired
};

constructor(props) {
Expand All @@ -47,16 +48,17 @@ export default class AlertDetailsToolbar extends React.Component {
}

render() {
const serviceOperation = {
const searchConstructor = {
serviceName: this.props.serviceName,
operationName: this.props.operationName
operationName: this.props.operationName,
interval: this.props.interval
};

const trendsLink = linkBuilder.universalSearchTrendsLink(serviceOperation);
const trendsLink = linkBuilder.universalSearchTrendsLink(searchConstructor);

const tracesLink = linkBuilder.universalSearchTracesLink(serviceOperation);
const tracesLink = linkBuilder.universalSearchTracesLink(searchConstructor);

const alertsLink = linkBuilder.withAbsoluteUrl(linkBuilder.universalSearchAlertsLink(serviceOperation));
const alertsLink = linkBuilder.withAbsoluteUrl(linkBuilder.universalSearchAlertsLink(searchConstructor));

return (
<div>
Expand Down
23 changes: 16 additions & 7 deletions src/components/alerts/details/alertHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default class AlertHistory extends React.Component {
operationName: PropTypes.string.isRequired,
serviceName: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
historyWindow: PropTypes.number.isRequired
historyWindow: PropTypes.number.isRequired,
interval: PropTypes.string.isRequired
};

static timeAgoFormatter(cell) {
Expand All @@ -55,7 +56,12 @@ export default class AlertHistory extends React.Component {
return value.toFixed();
}

static timeBufferAroundAlert = 10 * 60 * 1000; // 10 mins
static timeBufferAroundAlert = {
OneMinute: 10 * 60 * 1000, // 10 minutes
FiveMinute: 30 * 60 * 1000, // 30 minutes
FifteenMinute: 2 * 60 * 60 * 1000, // 2 hours
OneHour: 12 * 60 * 60 * 1000 // 12 hours
};

constructor(props) {
super(props);
Expand All @@ -65,22 +71,25 @@ export default class AlertHistory extends React.Component {
}

trendLinkCreator(timestamp) {
const from = (timestamp) - AlertHistory.timeBufferAroundAlert;
const to = (timestamp) + AlertHistory.timeBufferAroundAlert;
const buffer = AlertHistory.timeBufferAroundAlert[this.props.interval];
const from = (timestamp) - buffer;
const to = (timestamp) + buffer;

return linkBuilder.universalSearchTrendsLink({
serviceName: this.props.serviceName,
operationName: this.props.operationName,
time: {
from,
to
}
},
interval: this.props.interval
});
}

traceLinkCreator(timestamp) {
const from = (timestamp) - AlertHistory.timeBufferAroundAlert;
const to = (timestamp) + AlertHistory.timeBufferAroundAlert;
const buffer = AlertHistory.timeBufferAroundAlert[this.props.interval];
const from = (timestamp) - buffer;
const to = (timestamp) + buffer;

return linkBuilder.universalSearchTracesLink({
serviceName: this.props.serviceName,
Expand Down
4 changes: 3 additions & 1 deletion src/components/trends/details/trendDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default class TrendDetails extends React.Component {
serviceName: PropTypes.string.isRequired,
serviceSummary: PropTypes.bool,
opName: PropTypes.string,
statsType: PropTypes.string
statsType: PropTypes.string,
interval: PropTypes.oneOfType([null, PropTypes.string]).isRequired
};

static defaultProps = {
Expand All @@ -49,6 +50,7 @@ export default class TrendDetails extends React.Component {
serviceName={this.props.serviceName}
opName={this.props.opName}
statsType={this.props.statsType}
interval={this.props.interval}
/>
{ this.props.store.trendsPromiseState && this.props.store.trendsPromiseState.case({
empty: () => <Loading />,
Expand Down
9 changes: 6 additions & 3 deletions src/components/trends/details/trendDetailsToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default class TrendDetailsToolbar extends React.Component {
trendsStore: PropTypes.object.isRequired,
opName: PropTypes.string,
statsType: PropTypes.string,
serviceSummary: PropTypes.bool.isRequired
serviceSummary: PropTypes.bool.isRequired,
interval: PropTypes.oneOfType([null, PropTypes.string]).isRequired
};

static defaultProps = {
Expand Down Expand Up @@ -80,13 +81,14 @@ export default class TrendDetailsToolbar extends React.Component {
} = props.trendsStore.statsQuery;

const activeWindow = TrendDetailsToolbar.getActiveTimeWindow(from, until, isCustomTimeRange);
const granularityFromSearch = metricGranularity.options.find(option => option.longName === this.props.interval);

this.state = {
activeWindow,
activeGranularity: timeWindow.getLowerGranularity(activeWindow.value),
activeGranularity: granularityFromSearch || timeWindow.getLowerGranularity(activeWindow.value),
granularityDropdownOpen: false,
showCustomTimeRangePicker: false,
clipboardText: this.setClipboardText(activeWindow),
showCustomTimeRangePicker: false,
autoRefreshEnabled: false,
autoRefreshTimer: null,
countdownTimer: null
Expand All @@ -109,6 +111,7 @@ export default class TrendDetailsToolbar extends React.Component {
return linkBuilder.withAbsoluteUrl(linkBuilder.universalSearchTrendsLink({
serviceName: this.props.serviceName,
operationName: this.props.opName,
interval: this.props.interval,
time: {
from: activeWindow.from || timeWindow.toTimeRange(activeWindow.value).from,
to: activeWindow.until || timeWindow.toTimeRange(activeWindow.value).until
Expand Down
4 changes: 3 additions & 1 deletion src/components/trends/operation/operationResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import Error from '../../common/error';
export default class operationResults extends React.Component {
static propTypes = {
operationStore: PropTypes.object.isRequired,
serviceName: PropTypes.string.isRequired
serviceName: PropTypes.string.isRequired,
interval: PropTypes.oneOfType([null, PropTypes.string]).isRequired
};

render() {
Expand All @@ -42,6 +43,7 @@ export default class operationResults extends React.Component {
? <OperationResultsTable
operationStore={this.props.operationStore}
serviceName={this.props.serviceName}
interval={this.props.interval}
/>
: <Error errorMessage="There was a problem displaying operation results. Please try again later." />)
})
Expand Down
4 changes: 3 additions & 1 deletion src/components/trends/operation/operationResultsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import './operationResultsTable.less';
export default class OperationResultsTable extends React.Component {
static propTypes = {
serviceName: PropTypes.string.isRequired,
operationStore: PropTypes.object.isRequired
operationStore: PropTypes.object.isRequired,
interval: PropTypes.oneOfType([null, PropTypes.string]).isRequired
};

static Header({name}) {
Expand Down Expand Up @@ -81,6 +82,7 @@ export default class OperationResultsTable extends React.Component {
store={this.props.operationStore}
serviceName={this.props.serviceName}
opName={row.operationName}
interval={this.props.interval}
/>);
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/universalSearch/tabs/tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class Tabs extends React.Component {
case 'traces':
return <TraceResults tracesSearchStore={store} history={history} />;
case 'trends':
return <OperationResults operationStore={store} history={history} serviceName={this.props.search.serviceName} />;
return <OperationResults operationStore={store} history={history} serviceName={this.props.search.serviceName} interval={this.props.search.interval || null} />;
case 'alerts':
return <Alerts alertsStore={store} history={history} location={location} defaultPreset={timeWindow.presets[5]} serviceName={this.props.search.serviceName} interval={this.props.search.interval}/>;
case 'serviceGraph':
Expand Down

0 comments on commit d557cbe

Please sign in to comment.