Search code examples
springspring-bootspring-integrationpromqlspring-micrometer

spring integration metrics go missing on application restart


I use a spring boot application with IntegrationFlows, with micrometer for exposing metrics. When the flow starts I see a metric with name spring_integration_send_seconds_count denoting processed data, after the flow is complete the same metric goes to zero as expected.

However, on application restart this metric is non-existent and this is causing issues with applying PromQL functions. The frequency of the flow running cannot be predicted.

I did read on https://docs.spring.io/spring-integration/docs/5.3.2.RELEASE/reference/html/system-management.html#configuring-metrics-capture but even with defaultCountsEnabled enabled it doesn't initialize the said metric.

Is it possible to reset the spring integration flow metric on the application restart without hardcoding it?


Solution

  • Spring Integration metrics are registered when they are first used - you have to send a message to a channel before the metric will appear.