apache / incubator-kie-kogito-runtimes

Kogito Runtimes - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
541 stars 209 forks source link

Monitoring addon not working on Springboot #364

Closed r00ta closed 4 years ago

r00ta commented 4 years ago

Hi,

I'm trying to use the monitoring addon on Springboot and apparently the endpoint metrics is not exposed.

How to reproduce:

1) Checkout https://github.com/kiegroup/kogito-examples/tree/master/jbpm-springboot-example 2) add the dependency

    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>monitoring-prometheus-addon</artifactId>
    </dependency>

To the pom.xml And create the class ProcessEventListenerConfig:

package org.kie.kogito.examples;

import org.kie.kogito.process.impl.DefaultProcessEventListenerConfig;
import org.springframework.stereotype.Component;
import org.kie.addons.monitoring.process.PrometheusProcessEventListener;

@Component
public class ProcessEventListenerConfig extends DefaultProcessEventListenerConfig {

    public ProcessEventListenerConfig() {
        super(new PrometheusProcessEventListener("test"));
    }
}

3) run the app and execute

curl -d '{"approver" : "john", "order" : {"orderNumber" : "12345", "shipped" : false}}' -H "Content-Type: application/json" -X POST http://localhost:8080/orders

4) go to http://localhost:8080/metrics -> endpoint not available.

evacchi commented 4 years ago

is it working on quarkus?

r00ta commented 4 years ago

Yep, following the same steps on jbpm-quarkus-example (annotating the ProcessEventListenerConfig with @ApplicationScoped instead of @Component) it works as expected Screenshot from 2020-03-11 16-39-40

mswiderski commented 4 years ago

the problem is caused by configuration for which packages to scan for JAX-RS components

Somehow the prometheus add-on uses wrong package name and due to the cannot be found by default. It's classname is in org.kie.addons... while it should be in org.kie.kogito....

you can workaround this be setting following in 'application.properties'

resteasy.jaxrs.scan-packages=org.kie.kogito.**,org.kie.addons.**
evacchi commented 4 years ago

does this still apply? can we fix this in the addon?

mswiderski commented 4 years ago

I'd say it should be fixed in the prometheus-monitoring-addon to use org.kie.kogito as package

this property fix is more of a workaround

evacchi commented 4 years ago

created https://issues.redhat.com/browse/KOGITO-1452

evacchi commented 4 years ago

resolved