TrustyAI meets Kogito: decision monitoring

In this article, we introduce the metrics monitoring add-on for Kogito. This add-on is part of the TrustyAI initiative already introduced in the previous article .

Like Quarkus extensions, the Kogito add-ons are modules that can be imported as dependencies and add capabilities to the application. For example, another add-on is the infinispan-persistence-addon that enables the Infinispan persistence.

The add-on we introduce in this post was already available but now with version 0.11 of Kogito new features related to decision monitoring have been added:

  1. Export of domain specific monitoring metrics with Prometheus.
  2. Generate operational and domain specific grafana dashboards.

In the article cited above, we introduced three personas: the devops engineer, the case worker and the compliance officer. The current version of the add-on exports one or more dashboards for each DMN and DRL resource. In particular, two types of dashboards might be generated depending on the type of the resource: one with operational metrics more oriented for the devops engineer and one with domain specific metrics, oriented to the case worker and the compliance worker needs.

Operational dashboard: this kind of dashboard is generated for each DMN and DRL endpoint and it contains useful information to monitor the status of the applications so as to have a fast reaction in case something goes wrong. The available graphs are about:

  • The total number of requests on the endpoint.
  • The average number of requests on the endpoint per minute.
  • The quantiles on the elapsed time to evaluate the requests.
  • Exception details.

Domain specific dashboard: currently this dashboard is exported only for each DMN endpoint. In particular, the domain specific dashboard contains a graph for each type of decision in the DMN model. At the moment, the types number, boolean and string are supported, all the other time-based builtin types will be covered in the next Kogito release. In particular

  • if the output of the decision is a number, the graph contains the quantiles for that metric (on a sliding window of 3 minutes).
  • If the output is a boolean or a string, the graph contains the number of occurrences for each output (10 minutes average).
  • if the output is time-based, a graph containing the quantiles is generated (with different scales and measurement unit depending on the type).

The plan for the next versions of the add-on is to also support complex structures and lists. 

The devops engineer can directly use the dashboards that the add-on generates, or create custom ones manually based on the metrics exported by the application.

How To Use It

There are a few steps to follow to start using this add-on:

  • In your kogito project, assuming that you have imported the kogito bom to manage properly the versions of the kogito modules, import the monitoring-prometheus-addon in your pom.xml:
  •  In case you are interested about the number of requests on the endpoints and the status code of the responses, add the following class to your project
import org.kie.addons.monitoring.system.interceptor.MetricsInterceptor;
public class MyInterceptor extends MetricsInterceptor {
    public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
        super.filter(requestContext, responseContext);

At this point, once the application is packaged 

mvn clean package

the dashboards are generated under the path target/generated-resources/kogito/dashboards and the devops engineer can easily inject them during the deployment of the grafana container. 
For the grafana provisioning, we suggest having a look at the official Grafana documentation . The steps to deploy the dashboards will be integrated with Kogito Operator in a future release. 

That’s it! The Kogito application is ready to export operational and domain specific metrics on the endpoint /metrics.

A complete example can be found here


0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments