Collecting Process Instance, Activity Instance, and Transition Statistics

In this sample, you will use the tibco.bwce.sample.application.execution.event.subscribe sample to collect statistics for process instances, activity instances, and transitions in the tibco.bwce.sample.palette.http.RequestResponse sample project.

When working this sample, any of the following application statistics can be collected.

Process Instance Statistics

Statistic Description
Application Name Name of the application.
Application Version Version of the application.
Module Name Name of the TIBCO BusinessWorks Container Edition module.
Module Version Version of the TIBCO BusinessWorks Container Edition module.
Component Process Name Name of process configured to a component. If the process is a non in-lined sub process, this could be empty.
Job ID Job ID of the process.
Parent Process Name If the process is an in-lined sub process, the name of the parent process.
Parent Process ID If the process is an in-lined sub process, the instance ID of the parent process.
Process Name Name fo the process.
Process Instance ID Instance ID of the process.
Start Time Process instance start time.
End Time Process instance end time.
Elapsed Time Elapsed time of an activity is the time difference (in milliseconds) between start time and end time of the activity. Between the start and end time, control may get switched with other activities from the other jobs. This is the time taken to execute an activity plus all the delays in acquiring resources like engine threads, JDBC connections, network, and so on.

The elapsed time includes the execution time plus time taken for evaluating all the forward transitions from that particular activity and getting the next activity ready to execute, which includes executing its input mapping if all dependencies are met.

Eval Time The Eval Time for an activity is the actual time (in milliseconds) used by the activity itself to complete while using the engine thread. Asynchronous activities may use other threads not included in this time.
Status Status of process instance, for example: Completed or Faulted.

Activity Instance Statistics

Statistic Description
Application Name Name of the application.
Application Version Version of the application.
Module Name Name of the TIBCO BusinessWorks Container Edition module.
Module Version Version of the TIBCO BusinessWorks Container Edition module.
Activity Name Name of the activity.
Process Name Name of the process.
Process Instance ID Instance ID of the process.
Start Time When the activity instance started.
End Time When the activity instance ended.
Eval Time The time between the beginning and end of the evaluation period for the activity. If the activity completes in one step, the evalTime and elapsedTime would be the same. However, some activities, such as , Reply or Wait for... activities typically do not complete in one step.
Elapsed Time Elapsed time of an activity is the time difference (in milliseconds) between start time and end time of the activity. Between the start and end time, control may get switched with other activities from other jobs. This is the time taken to execute an activity plus all the delays in acquiring resources like engine threads, JDBC connections, network, and so on. The elapsed time is Eval Time plus the time taken for evaluating all the forward transitions from that particular activity.
Status Status of activity, for example: Completed, Faulted or Canceled.

Transition Statistics

Statistic Description
Application Name Name of the application.
Application Version Version of the application.
Module Name Name of the TIBCO BusinessWorks Container Edition module.
Module Version Version of the TIBCO BusinessWorks Container Edition module.
Transition Name Name of the transition
Process Name Name of the process.
Process Instance ID Instance ID of the process.
Component Process Name

Name of process configured to a component . If the process is a non in-lined subprocess, this could be empty.

Target Activity Name Name of the activity the transition targets.

Procedure

  1. Import the sample into TIBCO Business Studio by right-clicking in the Project Explorer pane, and selecting Import > Existing Studio Projects into Workspace.
  2. In the Import Projects window, ensure the option Select root directory field is selected, and specify the location of the tibco.bwce.sample.application.execution.event.subscribe sample. The sample is located at BWCE_HOME/samples/Container/docker/source/event-subscriber/tibco.bwce.sample.application.execution.event.subscriber.
  3. Click Finish to import the sample project.
  4. In the samples directory, select palette > http > RequestResponse and double-click tibco.bwce.sample.palette.http.RequestResponse.zip.
  5. In Project Explorer expand the tibco.bwce.sample.palette.http.RequestResponse project.
  6. Fully expand the Processes directory and double-click HTTP_Request_Response_Example.bwp.
  7. Click Run > Debug Configurations.
  8. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  9. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the check box next to tibco.bwce.sample.palette.http.RequestResponse.application.
  10. Click the Bundles tab and ensure the following bundles in your workspace are selected:
    • tibco.bwce.sample.application.execution.event.subscriber (1.0.0.qualifer)
    • tibco.bwce.sample.palette.http.RequestResponse (1.0.0.qualifer)
    • tibco.bwce.sample.palette.http.RequestResponse.application (1.0.0.qualifer)
  11. Click Debug.
    This will run the sample in Debug mode.
  12. Run lendpoints at the prompt in the Console tab to obtain the endpoint for the application.
  13. Copy the endpoint URL of the application.
  14. Open a browser window, and paste the endpoint URL into the address bar.
  15. Click the Terminate icon to stop the process.

Result

Details about process instances, activity instances, and transitions in tibco.bwce.sample.palette.http.RequestResponse are displayed on the Console tab in TIBCO Business Studio.
<>@BWEclipseAppNode>
ProcessInstance Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    State:SCHEDULED
}

ProcessInstance Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    State:STARTED
}

Activity Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    Activity Name:Incoming_HTTP_Request
    State:STARTED
}

Transition Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
Activity Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    Activity Name:Incoming_HTTP_Request
    Start Time:2019.01.10 11:20:50.947
    End Time:2019.01.10 11:20:51.339
    Eval Time:0
    Elapsed Time:392
    State:COMPLETED
}

Activity Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    Activity Name:Log1
    State:STARTED
}
11:20:51.361 INFO  [bwEngThread:In-Memory Process Worker-2] com.tibco.bw.palette.generalactivities.Log.tibco.bw.sample.palette.http.RequestResponse.Log1 - No matching 'NEWS' source found.

Activity Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    Activity Name:Log1
    Start Time:2019.01.10 11:20:51.350
    End Time:2019.01.10 11:20:51.362
    Eval Time:11
    Elapsed Time:12
    State:COMPLETED
}

ProcessInstance Auditing Event {
    Application Name:tibco.bw.sample.palette.http.RequestResponse.application
    Application Version:1.0
    Module Name:tibco.bw.sample.palette.http.RequestResponse
    Module Version:1.0.0.qualifier
    ProcessInstanceId:bw0a100
    Process Name:tibco.bw.sample.palette.http.requestresponse.HTTP_Request_Response_Example
    Start Time:2019.01.10 11:20:50.930
    End Time:2019.01.10 11:20:51.375
    Elapsed Time:445
    Eval Time:11
    State:COMPLETED
Tip: You can use this sample to build your own application statistics collection tool. Follow these steps to do this:
  1. From the Project Explorer tab, select tibco.bwce.sample.application.execution.event.subscriber > src > tibco.bwce.sample.application.execution.event.subscriber > BWEventSubscriber.java.
  2. Update handleEvent(Event event) method based on your use case.
  3. Save your changes to the project.
  4. Export the project as a plug-in by right clicking on tibco.bwce.sample.application.execution.event.subscriber and selecting export > Export > Plug-in Development > Deployable plug-ins and fragments.
  5. In the Export wizard, ensure the tibco.bwce.sample.application.execution.event.subscriber project is selected, and specify a location to export the plug-in.
  6. After the project has been exported as a plugin to the location you specified , locate the JAR in the plugins folder and copy it to a temporary folder. From the temporary folder use the Docker file given below to copy these JAR into the base Docker image.
    FROM tibco/bwce:latest
    COPY . /resources/addons/jars

Your application statistics collection tool has been added to your run time environment. You can see the application statistics after you create bwce application image from the base docker image.