Spring Integration - Unable to see metrics for MessageHandler, MessageChannel and MessageSource

Viewed 423

I have a prometheus metrics registry and captor beans registered as seen below:

"prometheusMeterRegistry": {
          "aliases": [],
          "scope": "singleton",
          "type": "io.micrometer.prometheus.PrometheusMeterRegistry",
          "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]",
          "dependencies": [
              "prometheusConfig",
              "collectorRegistry",
              "micrometerClock"
              ]
 },

"integrationMicrometerMetricsCaptor": {
          "aliases": [],
          "scope": "singleton",
          "type": "org.springframework.integration.support.management.micrometer.MicrometerMetricsCaptor",
          "resource": null,
          "dependencies": []
},

However, when I check the actuator/prometheus endpoint, I don't see any metrics for MessageHandler, MessageChannel and MessageSource which are mentioned here. The only spring-integeration metrics available are:

spring_integration_sources 1.0

spring_integration_handlers 17.0

spring_integration_channels 15.0

I also ran data through my flows, still can't see the metrics. What am I missing?

1 Answers

Thank you for such a great sample!

So, your problem is here:

<!-- Enable Spring Integration Metrics -->
<int:management/>

First of all you must not do this since Spring Boot auto-configures this for us. (We probably need to improve Spring Boot docs to mention that feature).

Secondly you still can do this but you need to use this option:

        <xsd:attribute name="default-counts-enabled" use="optional">
            <xsd:annotation>
                <xsd:documentation>
                    The default value for components that don't match 'counts-enabled-patterns'.
                    Defaults to false, or true when an Integration MBean Exporter is provided.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>

and set it to true.

In the current Spring Integration 5.4 version it is deprecated already. We definitely are going to remove it altogether in the next 6.0.

Related