apache / camel-quarkus

Apache Camel Quarkus
https://camel.apache.org
Apache License 2.0
256 stars 189 forks source link

Micromether Metrics with prometheus not showing Kafka metrics from camel-quarkus-kafka #4313

Open mmacphail opened 1 year ago

mmacphail commented 1 year ago

In my camel-quarkus-kafka project, producer Kafka metrics are not showing up in the Micrometer prometheus endpoint.

The example project is available on github. If the project is ran, no Kafka metrics will appear in Micrometer prometheus endpoint. Other metrics such as camel metrics appear.

My route:

public class ExampleRoute extends RouteBuilder {

  @Override
  public void configure() throws Exception {
    from(timer("foo").period(1000))
          .to(kafka("test"));
  }
}

Configuration:

quarkus.camel.metrics.enable-message-history=true
quarkus.kafka.devservices.enabled=true
quarkus.micrometer.binder.kafka.enabled=true

I would expect the third property to do the trick according to the Quarkus Micrometer documentation.

Dependencies:

  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-reactive-jackson</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.quarkus</groupId>
      <artifactId>camel-quarkus-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-micrometer-registry-prometheus</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.quarkus</groupId>
      <artifactId>camel-quarkus-kafka</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-reactive</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.quarkus</groupId>
      <artifactId>camel-quarkus-micrometer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.quarkus</groupId>
      <artifactId>camel-quarkus-timer</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-micrometer</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-arc</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
jamesnetherton commented 1 year ago

The way that Quarkus configures the binder will not work for camel-quarkus-kafka.

Maybe there's a way to replicate the functionality. It would need investigating.

mmacphail commented 1 year ago

I'm curious as of why it wouldn't work ? As far as I understood as long as the Kafka Consumer or Producer interface is on the classpath it should collect the metrics according to the documentation.

jamesnetherton commented 1 year ago

I'm curious as of why it wouldn't work ?

From what I saw of the code, it assumes the Kafka consumer / producer is a CDI bean. Which is not the case for camel-quarkus-kafka.