From 8e56740e624e28f71af219c9c3850dde46143391 Mon Sep 17 00:00:00 2001 From: Marcus Aspin Date: Thu, 11 Jul 2024 15:31:31 +0100 Subject: [PATCH] PI-2342 Capture dependencies across message boundaries (#23) --- src/data/Components.ts | 2 ++ src/data/appInsights/queries.ts | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/data/Components.ts b/src/data/Components.ts index 1e302b6..f251b45 100644 --- a/src/data/Components.ts +++ b/src/data/Components.ts @@ -21,6 +21,8 @@ export class Components { return environments.flatMap(env => [ [env.hostname, component], [env.clusterHostname, component], + ]).concat([ + [component.cloudRoleName, component], ]) }), ) diff --git a/src/data/appInsights/queries.ts b/src/data/appInsights/queries.ts index e873295..b1583a9 100644 --- a/src/data/appInsights/queries.ts +++ b/src/data/appInsights/queries.ts @@ -1,10 +1,21 @@ const Queries = { DEPENDENCIES: () => ` + let since = ago(3d); dependencies - | where timestamp > ago(3d) - | project cloud_RoleName, type, target - | where cloud_RoleName != "" and type <> "InProc" and type <> 'Ajax' - | distinct cloud_RoleName, target, type + | where timestamp > since + | where isnotempty(cloud_RoleName) + | distinct cloud_RoleName, target, type, id=iff(name startswith "PUBLISH ", id, "") + | join kind=leftouter ( + requests + | where timestamp > since + | where isnotempty(cloud_RoleName) and name startswith "RECEIVE " + | distinct id = operation_ParentId, consumer_RoleName = cloud_RoleName, type = "messaging" + ) on id + | distinct + cloud_RoleName=iff(type1 == "messaging", consumer_RoleName, cloud_RoleName), + target=iff(type1 == "messaging", cloud_RoleName, target), + type = coalesce(type1, type) + | where type <> "InProc" and type <> "Ajax" `, }