A first step in analyzing results of executing Decision Services is to gain visibility to the rules that fired. With rule tracing, you can see which rules and Rulesheets fired in processing a work document. There are two techniques for tracing rule execution:
  • Rule trace viewer—See all the actions that took place in a Ruletest with the click of a button. Drill into the changes and make changes to the source files immediately.
  • Rule message metadata—Set up rule messages to expose metadata about selected rules in Studio Tester as well as with deployed Decision Services.
Note: The following examples use the Advanced Tutorial's Ruleflow as the test subject. The Ruleflow has three Rulesheets, each with conditional and non-conditional rules. Here is the output of the coupons.ert Ruletest:

RULE TRACE VIEWER

You can reduce the time it takes diagnose rule execution problems by efficiently analyzing the Ruletest as it executes to trace all the rules that fired. Run a Ruletest with the additional functionality of the Rule Trace Viewer by just clicking a button:

The Ruletest runs the test as well a rule trace across all Rulesheets, and then presents the results in the Rule Trace tab, as shown:


The results of a rule trace are dynamic:
  • Highlight—Click anywhere on a line to highlight that element in the Testsheet output. Click on any item in the Ruletest to see all the rules related to that element highlighted in the Rule Trace Viewer.
  • Sort—Click on any column header in the Rule Trace tab to sort the tab content in ascending order. Click again to sort into descending order.
  • Locate—Double-click on any line to open the related Rulesheet positioned at the Action line and rule. The Rulesheet is in editable form so you can make adjustments quickly, and run again to see the effects of changes.
Note: The Rule Trace Viewer is based on JSON. If you have the Studio property com.corticon.tester.ccserver.execute.format set to XML (instead of the default, JSON), the Rule Trace Viewer function is inoperative.

RULE MESSAGE METADATA

You can expose the Rulesheet and rule for items that you have specified in rule statements, including selected values as illustrated:

Figure 1. Rule messages when metadata is enabled in Studio
To enable this function, add a line to the brms.properties as:
com.corticon.reactor.rulestatement.metadata=true
After deployment, testing execution of the Decision Service in the Studio and in the Web Console shows that the metadata is exposed in the response, as shown for the Web Console:
While this can be useful in tracing deployment problems, the metadata will remain in production until you shut off the feature and generate a new decision service.