Chapter 13. Red Hat Process Automation Manager Kogito Operator interaction with Prometheus and Grafana Red Hat build of Kogito in Red Hat Decision Manager provides a monitoring-prometheus-addon add-on that enables Prometheus metrics monitoring for Red Hat build of Kogito microservices and generates Grafana dashboards that consume the default metrics exported by the add-on. The RHPAM Kogito Operator uses the Prometheus Operator to expose the metrics from your project for Prometheus to scrape. Due to this dependency, the Prometheus Operator must be installed in the same namespace as your project. If you want to enable the Prometheus metrics monitoring for your Red Hat build of Kogito microservices, add the following dependency to the pom.xml file in your project, depending on the framework you are using: Dependency for Prometheus Red Hat build of Quarkus add-on <dependency> <groupId>org.kie.kogito</groupId> <artifactId>monitoring-prometheus-quarkus-addon</artifactId> </dependency> Dependency for Prometheus Spring Boot add-on <dependency> <groupId>org.kie.kogito</groupId> <artifactId>monitoring-prometheus-springboot-addon</artifactId> </dependency> When you deploy a Red Hat build of Kogito microservice that uses the monitoring-prometheus-addon add-on and the Prometheus Operator is installed, the Red Hat Process Automation Manager Kogito Operator creates a ServiceMonitor custom resource to expose the metrics for Prometheus, as shown in the following example: Example ServiceMonitor resource for Prometheus apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: app: onboarding-service name: onboarding-service namespace: kogito spec: endpoints: - path: /metrics targetPort: 8080 scheme: http namespaceSelector: matchNames: - kogito selector: matchLabels: app: onboarding-service You must manually configure your Prometheus custom resource that is managed by the Prometheus Operator to select the ServiceMonitor resource: Example Prometheus resource apiVersion: monitoring.coreos.com/v1 kind: Prometheus metadata: name: prometheus spec: serviceAccountName: prometheus serviceMonitorSelector: matchLabels: app: dmn-drools-quarkus-metrics-service After you configure your Prometheus resource with the ServiceMonitor resource, you can see the endpoint scraped by Prometheus in the Targets page in the Prometheus web console. The metrics exposed by the Red Hat Decision Manager service appear in the Graph view. The RHPAM Kogito Operator also creates a GrafanaDashboard custom resource defined by the Grafana Operator for each of the Grafana dashboards generated by the add-on. The app label for the dashboards is the name of the deployed Red Hat build of Kogito microservice. You must set the dashboardLabelSelector property of the Grafana custom resource according to the relevant Red Hat build of Kogito microservice. Example Grafana resource apiVersion: integreatly.org/v1alpha1 kind: Grafana metadata: name: example-grafana spec: ingress: enabled: true config: auth: disable_signout_menu: true auth.anonymous: enabled: true log: level: warn mode: console security: admin_password: secret admin_user: root dashboardLabelSelector: - matchExpressions: - key: app operator: In values: - my-kogito-application

Commands:
<dependency> <groupId>org.kie.kogito</groupId> <artifactId>monitoring-prometheus-quarkus-addon</artifactId> </dependency>
<dependency> <groupId>org.kie.kogito</groupId> <artifactId>monitoring-prometheus-springboot-addon</artifactId> </dependency>
apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: app: onboarding-service name: onboarding-service namespace: kogito spec: endpoints: - path: /metrics targetPort: 8080 scheme: http namespaceSelector: matchNames: - kogito selector: matchLabels: app: onboarding-service
apiVersion: monitoring.coreos.com/v1 kind: Prometheus metadata: name: prometheus spec: serviceAccountName: prometheus serviceMonitorSelector: matchLabels: app: dmn-drools-quarkus-metrics-service
apiVersion: integreatly.org/v1alpha1 kind: Grafana metadata: name: example-grafana spec: ingress: enabled: true config: auth: disable_signout_menu: true auth.anonymous: enabled: true log: level: warn mode: console security: admin_password: secret admin_user: root dashboardLabelSelector: - matchExpressions: - key: app operator: In values: - my-kogito-application