Useful queries for analysis
Bot steps to Bot Sources mapping
It might be useful to understand potential bottle-necks within BP code
select count(*) from Run r
join CampaignMap cm on cm.id=r.campaignMap_id
join Campaign c on c.id=cm.campaign
join MACHINE_CONFIG mc on mc.id=c.machineConfigId
join MachineCampaignSource ms on ms.id=mc.source_id
where ms.`name`="<BOT_SOURCE_NAME>" and r.status="MACHINE_PROCESSING";
Bot steps content search
If you need to search withing bot config code you can use the following query:
select MACHINE_CONFIG.id, MACHINE_CONFIG.name
from MACHINE_CONFIG
where MACHINE_CONFIG.content like '%<STRING_TO_SEARCH_FOR>%'
You can map look for found machine configs recently executed by the following query (it will look up to 3-rd level of bot configs inclusion)
select r.rootRunUuid, mc.id, mc.name as name1, mc1Level.name as name2,
mc2Level.name as name3, mc3Level.name as name4, r.startDate
from MACHINE_CONFIG mc
join Campaign on mc.id=Campaign.machineConfigId
join Run r on r.campaign_id =Campaign.id
left join MachineConfigInclusion mci1 on mci1.includerId = mc.id
left join MACHINE_CONFIG mc1Level on mci1.includedId = mc1Level.id
left join MachineConfigInclusion mci2 on mci2.includerId = mc1Level.id
left join MACHINE_CONFIG mc2Level on mci2.includedId = mc2Level.id
left join MachineConfigInclusion mci3 on mci3.includerId = mc2Level.id
left join MACHINE_CONFIG mc3Level on mci3.includedId = mc3Level.id
where ( mc.content like '%<STRING_TO_SEARCH_FOR>%' or
mc1Level.content like '%<STRING_TO_SEARCH_FOR>%' or
mc2Level.content like '%<STRING_TO_SEARCH_FOR>%' or
mc3Level.content like '%<STRING_TO_SEARCH_FOR>%')
and r.startDate>"2018-05-20";
Business Process and Step Title search by Run.id
Sometimes it is required to understand what BP and Step is executed based on run.id. Usually you can get run.id from thread name (either in error log or in thread dump). You can use the following SQL to get additional information on this step:
select r.id, r.title as step_title, r.startDate, r.endDate, c.title as BP_title
from Run r
join CampaignMap cm on cm.id=r.campaignMap_id
join Campaign c on cm.parent=c.id
where r.id=<ID_TO_SEARCH>
Active Business Processes that run on the instance
You can use the following SQL to list all BPs that are currently running on the instance:
select definition.title as BP_title, r.rootRunUUID, r.title as step_title, r.status as step_status
from Run r
join Run definition on definition.childrenRunUUID = r.rootRunUUID
where r.status IN ('MACHINE_PROCESSING', 'PROCESSING');