Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support search by trace IDs #1

Merged
merged 1 commit into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/components/SearchTracePage/TraceSearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export function tagsToQuery(tags) {
return tags.split('|');
}

export function traceIDsToQuery(traceIDs) {
if (!traceIDs) {
return null;
}
return traceIDs.split(',');
}

export function convertQueryParamsToFormDates({ start, end }) {
let queryStartDate;
let queryStartDateTime;
Expand Down Expand Up @@ -246,6 +253,7 @@ const mapStateToProps = state => {
maxDuration,
minDuration,
lookback,
traceID: traceIDParams,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the format of the URL here?
traceID=1&traceID=2 or traceID=1,2

If the later, let's use traceIDs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the format is traceID=1&traceID=2, same as with tags

} = state.routing.locationBeforeTransitions.query;

const nowInMicroseconds = moment().valueOf() * 1000;
Expand All @@ -271,6 +279,12 @@ const mapStateToProps = state => {
if (tagParams) {
tags = tagParams instanceof Array ? tagParams.join('|') : tagParams;
}
let traceIDs;
if (traceIDParams) {
traceIDs = traceIDParams instanceof Array
? traceIDParams.join(',')
: traceIDParams;
}
return {
destroyOnUnmount: false,
initialValues: {
Expand All @@ -285,6 +299,7 @@ const mapStateToProps = state => {
tags,
minDuration: minDuration || null,
maxDuration: maxDuration || null,
traceIDs: traceIDs || null,
},
selectedService: searchSideBarFormSelector(state, 'service'),
selectedLookback: searchSideBarFormSelector(state, 'lookback'),
Expand All @@ -307,6 +322,7 @@ const mapDispatchToProps = dispatch => {
minDuration,
maxDuration,
lookback,
traceIDs,
} = fields;

store.set('lastSearch', { service, operation });
Expand Down Expand Up @@ -339,6 +355,7 @@ const mapDispatchToProps = dispatch => {
tag: tagsToQuery(tags) || undefined,
minDuration: minDuration || null,
maxDuration: maxDuration || null,
traceID: traceIDsToQuery(traceIDs) || undefined,
});
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchTracePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const traceResultsFiltersFormSelector = formValueSelector(
export default class SearchTracePage extends Component {
componentDidMount() {
const { searchTraces, urlQueryParams, fetchServices } = this.props;
if (urlQueryParams.service) {
if (urlQueryParams.service || urlQueryParams.traceID) {
searchTraces(urlQueryParams);
}
fetchServices();
Expand Down