Skip to content

Commit

Permalink
code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ogupte committed Aug 2, 2019
1 parent e10af0e commit 5a299b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Expand Up @@ -5,15 +5,7 @@
*/

import theme from '@elastic/eui/dist/eui_theme_light.json';
import {
flatten,
groupBy,
indexBy,
isEmpty,
sortBy,
uniq,
zipObject
} from 'lodash';
import { flatten, groupBy, indexBy, sortBy, uniq, zipObject } from 'lodash';
import { idx } from '@kbn/elastic-idx';
import { TraceAPIResponse } from '../../../../../../../../server/lib/traces/get_trace';
import { StringMap } from '../../../../../../../../typings/common';
Expand Down Expand Up @@ -226,7 +218,7 @@ export function getWaterfall(
{ root: traceRoot, trace, errorsPerTransaction }: TraceAPIResponse,
entryTransactionId?: Transaction['transaction']['id']
): IWaterfall {
if (traceRoot === undefined || isEmpty(trace) || !entryTransactionId) {
if (traceRoot === undefined || !entryTransactionId) {
return {
services: [],
duration: 0,
Expand Down
5 changes: 2 additions & 3 deletions x-pack/legacy/plugins/apm/server/lib/traces/get_trace_root.ts
Expand Up @@ -5,6 +5,7 @@
*/

import { SearchParams } from 'elasticsearch';
import { idx } from '@kbn/elastic-idx';
import {
PROCESSOR_EVENT,
TRACE_ID,
Expand Down Expand Up @@ -40,9 +41,7 @@ export async function getTraceRoot(traceId: string, setup: Setup) {
};

const resp = await client.search<Transaction>(params);
const root = resp.hits.hits.map(hit => hit._source)[0] as
| Transaction
| undefined;
const root: Transaction | undefined = idx(resp, _ => _.hits.hits[0]._source);

return root;
}

0 comments on commit 5a299b3

Please sign in to comment.