TrustyAI meets Kogito: the decision tracing addon

New to Kogito? Check out our “get started” page and get up to speed! 😉

This post presents the decision tracing addon: a component of the Kogito runtime quite relevant for the TrustyAI initiative (introduced here and here).

One of the key goals of TrustyAI is to enable advanced auditing capabilities, which, as written in the second introductory post, “enables a compliance officer to trace the decision making of the system and ensure it meets regulations”.

The capability to export auditable information whenever a key event occurs is the first mandatory feature that such a system must provide in order to achieve this goal. This is exactly the purpose of the decision tracing addon.

Key concepts

The addon focuses on Kogito applications exposing DMN models (hence the “decision” in the name). Every time a model is executed, it emits a TraceEvent containing all the relevant information about the execution.

Here are some key concepts:

  • It works for Kogito applications based on both Quarkus and Spring Boot.
  • The TraceEvent is wrapped in a CloudEvent envelope.
  • TraceEvents are sent as JSON to a Kafka topic.

The Trusty Service is the designated component of TrustyAI that consumes these events. With Kafka acting as a decoupler, however, custom consumers can be written to match any specific need.

How to use it

The addon has been available as part of Kogito since v0.17.0. It leverages the code generation capabilities of Kogito to minimize the effort required to enable it. There are only two steps:

  1. Add it to the dependencies of your project. Make sure to pick the flavour that matches the underlying framework of your Kogito service.
  2. Add some properties to configure the connection to Kafka. They currently differ depending on the flavour, so pick the right ones (check the examples below).

Note: be aware that API changes may still occur in the next releases. Also, bugs may be there (that’s code after all, isn’t it?). If you find one, let us know via Kogito Jira.

Usage with Quarkus

  1. Here is the dependency to add to your pom.xml (version is automatically taken from kogito-bom):
<dependency>
  <groupId>org.kie.kogito</groupId>
  <artifactId>tracing-decision-quarkus-addon</artifactId>
</dependency>
  1. The Quarkus addon uses MicroProfile Reactive Messaging under the hood, so the configuration follows the same rules. Here are the properties:
# Where to find the Kafka broker
kafka.bootstrap.address=localhost:9092

# These two properties must be set with these exact values
mp.messaging.outgoing.kogito-tracing-decision.connector=smallrye-kafka
mp.messaging.outgoing.kogito-tracing-decision.value.serializer=org.apache.kafka.common.serialization.StringSerializer

# These values can be changed with your kafka group ID and topic
# If the topic doesn't exist, the addon tries to create it automatically
mp.messaging.outgoing.kogito-tracing-decision.group.id=kogito-runtimes
mp.messaging.outgoing.kogito-tracing-decision.topic=kogito-tracing-decision

Example with Quarkus

A detailed example on how to use the decision tracing addon with Quarkus can be found here in our kogito-examples repository.

Usage with Spring Boot

  1. Here is the dependency to add to your pom.xml (version is automatically taken from kogito-springboot-starter):
<dependency>
  <groupId>org.kie.kogito</groupId>
  <artifactId>tracing-decision-springboot-addon</artifactId>
</dependency>
  1. Here are the properties:
# Where to find the Kafka broker
kogito.addon.tracing.decision.kafka.bootstrapAddress=localhost:9092

# The topic name
kogito.addon.tracing.decision.kafka.topic.name:kogito-tracing-decision

# If the topic doesn't exist, the addon tries to create it automatically
# These two additional properties can configure the auto generation
kogito.addon.tracing.decision.kafka.topic.partitions=1
kogito.addon.tracing.decision.kafka.topic.replicationFactor=1

Example with Spring Boot

A detailed example on how to use the decision tracing addon with Spring Boot can be found here in our kogito-examples repository.

Next steps

We’re only at the beginning of the TrustyAI journey. If you want to be part of it with us, stay tuned for more news!

Thanks for reading. 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments