File tree Expand file tree Collapse file tree
x-pack/plugins/apm/server/lib/service_map Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * or more contributor license agreements. Licensed under the Elastic License;
44 * you may not use this file except in compliance with the Elastic License.
55 */
6+ import { rangeFilter } from '../../../common/utils/range_filter' ;
67import { ProcessorEvent } from '../../../common/processor_event' ;
78import { TRACE_ID } from '../../../common/elasticsearch_fieldnames' ;
89import {
910 ConnectionNode ,
1011 ExternalConnectionNode ,
1112 ServiceConnectionNode ,
1213} from '../../../common/service_map' ;
13- import { Setup } from '../helpers/setup_request' ;
14+ import { Setup , SetupTimeRange } from '../helpers/setup_request' ;
1415
1516export async function fetchServicePathsFromTraceIds (
16- setup : Setup ,
17+ setup : Setup & SetupTimeRange ,
1718 traceIds : string [ ]
1819) {
1920 const { apmEventClient } = setup ;
2021
22+ // make sure there's a range so ES can skip shards
23+ const dayInMs = 24 * 60 * 60 * 1000 ;
24+ const start = setup . start - dayInMs ;
25+ const end = setup . end + dayInMs ;
26+
2127 const serviceMapParams = {
2228 apm : {
2329 events : [ ProcessorEvent . span , ProcessorEvent . transaction ] ,
@@ -32,6 +38,7 @@ export async function fetchServicePathsFromTraceIds(
3238 [ TRACE_ID ] : traceIds ,
3339 } ,
3440 } ,
41+ { range : rangeFilter ( start , end ) } ,
3542 ] ,
3643 } ,
3744 } ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010 SERVICE_NAME ,
1111} from '../../../common/elasticsearch_fieldnames' ;
1212import { Connection , ConnectionNode } from '../../../common/service_map' ;
13- import { Setup } from '../helpers/setup_request' ;
13+ import { Setup , SetupTimeRange } from '../helpers/setup_request' ;
1414import { fetchServicePathsFromTraceIds } from './fetch_service_paths_from_trace_ids' ;
1515
1616export function getConnections ( {
@@ -79,7 +79,7 @@ export async function getServiceMapFromTraceIds({
7979 serviceName,
8080 environment,
8181} : {
82- setup : Setup ;
82+ setup : Setup & SetupTimeRange ;
8383 traceIds : string [ ] ;
8484 serviceName ?: string ;
8585 environment ?: string ;
You can’t perform that action at this time.
0 commit comments