diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts index 2c210f6e4b0e7..0934cb0019f44 100644 --- a/x-pack/legacy/plugins/apm/index.ts +++ b/x-pack/legacy/plugins/apm/index.ts @@ -72,7 +72,7 @@ export const apm: LegacyPluginInitializer = kibana => { // service map serviceMapEnabled: Joi.boolean().default(false), - serviceMapInitialTimeRange: Joi.number().default(60 * 1000 * 15) // last 15 minutes + serviceMapInitialTimeRange: Joi.number().default(60 * 1000 * 60) // last 1 hour }).default(); }, diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx index 62c8d44f09811..bc020815cc9cb 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx @@ -62,7 +62,6 @@ export function Cytoscape({ // Trigger a custom "data" event when data changes useEffect(() => { if (cy) { - // cy.remove(cy.nodes()); cy.add(elements); cy.trigger('data'); } diff --git a/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts b/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts index df76f54a00cab..ea9af12ac7f9a 100644 --- a/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts +++ b/x-pack/legacy/plugins/apm/server/lib/service_map/get_service_map_from_trace_ids.ts @@ -75,7 +75,7 @@ export async function getServiceMapFromTraceIds({ map_script: { lang: 'painless', source: `def id; - if (!doc['span.id'].empty) { + if (!doc['span.id'].empty) { id = doc['span.id'].value; } else { id = doc['transaction.id'].value; @@ -106,12 +106,12 @@ export async function getServiceMapFromTraceIds({ destination['span.subtype'] = event['span.subtype']; return destination; } - + def processAndReturnEvent(def context, def eventId) { if (context.processedEvents[eventId] != null) { return context.processedEvents[eventId]; } - + def event = context.eventsById[eventId]; if (event == null) { @@ -141,7 +141,8 @@ export async function getServiceMapFromTraceIds({ if (parent['destination.address'] != null && parent['destination.address'] != "" - && parent['span.type'] == 'external' + && (parent['span.type'] == 'external' + || parent['span.type'] == 'messaging') && (parent['service.name'] != event['service.name'] || parent['service.environment'] != event['service.environment'] ) @@ -154,7 +155,7 @@ export async function getServiceMapFromTraceIds({ def lastLocation = basePath.size() > 0 ? basePath[basePath.size() - 1] : null; - def currentLocation = new HashMap(service); + def currentLocation = service; /* only add the current location to the path if it's different from the last one*/ if (lastLocation == null || !lastLocation.equals(currentLocation)) { @@ -162,7 +163,7 @@ export async function getServiceMapFromTraceIds({ } /* if there is an outgoing span, create a new path */ - if (event['destination.address'] != null && event['destination.address'] != '') { + if (event['span.type'] == 'external' || event['span.type'] == 'messaging') { def outgoingLocation = getDestination(event); def outgoingPath = new ArrayList(basePath); outgoingPath.add(outgoingLocation); @@ -179,7 +180,7 @@ export async function getServiceMapFromTraceIds({ context.processedEvents = new HashMap(); context.eventsById = new HashMap(); - + context.paths = new HashSet(); context.externalToServiceMap = new HashMap(); context.locationsToRemove = new HashSet(); @@ -195,8 +196,8 @@ export async function getServiceMapFromTraceIds({ def paths = new HashSet(); for(foundPath in context.paths) { - if (!context.locationsToRemove.contains(foundPath)) { - paths.add(foundPath); + if (!context.locationsToRemove.contains(foundPath)) { + paths.add(foundPath); } } diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index a65907fbb099a..e301d157d2c7c 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -16,7 +16,7 @@ export const config = { }, schema: schema.object({ serviceMapEnabled: schema.boolean({ defaultValue: false }), - serviceMapInitialTimeRange: schema.number({ defaultValue: 60 * 1000 * 15 }), // last 15 minutes + serviceMapInitialTimeRange: schema.number({ defaultValue: 60 * 1000 * 60 }), // last 1 hour autocreateApmIndexPattern: schema.boolean({ defaultValue: true }), ui: schema.object({ enabled: schema.boolean({ defaultValue: true }),