Meego Wiki
Views

Release Infrastructure/BOSS/BOSS Tracer

From MeeGo wiki
Jump to: navigation, search

The BOSS tracer will contains --

  1. a ruote service embeded in ruote engine, it creates 1 record in Processes table and 1+ records in Participants table after each process gets handled, then puts the records into a queue.
  2. a separate thread run within ruote engine or a separate process, will fetch the records from the queue, then write them into a database(mysql, maybe).
  3. a UI to get what we want with a series of SQL statements.

Take the following process definition as a example,

pdef = Ruote.process_definition do
    sequence do
        concurrence do
            alpha :time => 7
            alpha :time => 5
            alpha :time => 3
        end
        charly :time => 11
    end
end

If it runs successfully, it will generates 4 records for Participants table,

alpha	20101228-boguderoba	0_0_0_2	2010-12-28 05:42:53	2010-12-28 05:42:56	3	receive
alpha	20101228-boguderoba	0_0_0_1	2010-12-28 05:42:53	2010-12-28 05:42:58	5	receive
alpha	20101228-boguderoba	0_0_0_0	2010-12-28 05:42:53	2010-12-28 05:43:00	7	receive
charlay	20101228-boguderoba	0_0_1	2010-12-28 05:43:00	2010-12-28 05:43:11	11	receive

and 1 record for Processes table.

20101228-boguderoba | ["define",{},[["sequence",{},
[["concurrence",{},[["alpha",{"time":7},[]],["alpha",{"time":5},[]],
["alpha",{"time":3},[]]]],["charlay",{"time":11},[]]]]]] | 2010-12-28 05:42:53 | 2010-12-28 05:43:11 | 18 | terminated

If it fails, it will generates 3 records for Participants table,

alpha	20101228-bezuponusa	0_0_0_1	2010-12-28 06:28:32	2010-12-28 06:28:35	3	error_intercepted
alpha	20101228-bezuponusa	0_0_0_2	2010-12-28 06:28:32	2010-12-28 06:28:35	3	error_intercepted
alpha	20101228-bezuponusa	0_0_0_0	2010-12-28 06:28:32	2010-12-28 06:28:35	3	error_intercepted

and 1 record for Processes table.

20101228-bezuponusa | ["define",{},[["sequence",{},[["concurrence",{},[["alpha",{"time":7},[]],
["alpha",{"time":5},[]],["alpha",{"time":3},[]]]],
["charlay",{"time":11},[]]]]]] | 2010-12-28 06:28:32 | 2010-12-28 06:28:35 | 3 | error_intercepted

Processes table

Processes table
field description example
wfid string to identify this process(workflow) 20101223-bemuboyawo
tree string to describe this process(process definition) ["define",{},[["sequence",{},[["concurrence",{},[["alpha",{"time":7},[]],["alpha",{"time":5},[]],["alpha",{"time":3},[]]]],["charly",{},[]]]]]]
launched time when to launch this process 2010-12-23 05:51:13.441734 UTC
last active time when this process last get handled 2010-12-23 05:51:16.472734 UTC
duration how much seconds this process takes to finish 21
last action string to describe what state this process finally gets, terminated means the process is successfully finished, error_intercepted means the process fails terminated | error_intercepted
launched_workitem the work item fed to this process {"fields":{},"fei":{"sub_wfid":null,"wfid":"20110310-bizugugebi","engine_id":"engine","expid":"0"}}
terminated_workitem the work item this process produced {"participant_name":"charlay","fields":{"__result__":11},"fei":{"sub_wfid":null,"wfid":"20110310-bizugugebi","engine_id":"engine","expid":"0_0"}}

Participants table

Participants table
field description example
name string alpha
wfid string to identify which process(workflow) this participant instance gets involved 20101223-bemuboyawo
expid string to distinguish participants with same name 0_0_0_2
dispatched time when this participant gets start to work 2010-12-23 05:51:24.801734 UTC
last active time when this participant gets stop to work 2010-12-23 05:51:27.816734 UTC
duration how much seconds this participant takes to finish 11
last action string to describe what state this participant finally gets, terminated means the participant is successfully finished, error_intercepted means the participant fails terminated | error_intercepted
dispatched_workitem the work item fed to this participant {"participant_name":"charlay","fields":{"dispatched_at":"2011-03-10 03:08:55.769842 UTC","__result__":3,"params":{"time":11,"ref":"charlay"}},"fei":{"sub_wfid":null,"wfid":"20110310-bizugugebi","engine_id":"engine","expid":"0_0_1"}}
received_workitem the work item this participant produced {"participant_name":"charlay","fields":{"__result__":11},"fei":{"sub_wfid":null,"wfid":"20110310-bizugugebi","engine_id":"engine","expid":"0_0_1"}}


Some use cases:

  • Find the most time-consuming participant and the involved process --
select * from participants left join processes on participants.wfid = processes.wfid 
where participants.duration = (select max(duration) from participants);
  • Find the most time-consuming process, and list all its dependant participants --
select * from participants where participants.wfid in 
(select wfid from processes where processes.duration = (select max(duration) from processes));
  • Find how much time participant alpha takes to finish successfully on average --
select avg(duration) from participants where name='alpha' and last_action='receive';
  • Find the success rate of participant alpha --
select (select count(*) from participants where name='alpha' and last_action='receive')/(select count(*) from participants where name='alpha');
  • Find how much time a process(which is defined as tree field says) takes to finish successfully on average during last week --
select avg(duration) from processes where tree='["define",{},[["sequence",{},[["concurrence",{},[["alpha",{"time":7},[]],["alpha",{"time":5},[]],["alpha",{"time":3},[]]]],["charlay",{"time":11},[]]]]]]'
 and last_action='terminated' and TIMESTAMPDIFF(day,launched,now())<8;


implementation

Personal tools