java Spring集成支持集成管理和MetricRegistry
我已经阅读了Spring Integration 4.2.0.RELEASE
中的新功能,该功能通过@EnableIntegrationManagement
注释和MetricsFactory
实现捕获通道和处理程序上的计数和统计信息,这里:http://docs.spring.io/spring-integration/docs/4.2.0.RELEASE/reference/html/system-management-chapter.html
我还知道这里有一个待定的更新:https://github.com/spring-projects/spring-integration/pull/1568
我看到有MBean导出功能,但我真的希望通过Spring Boot actuator的/metrics
端点显示计数和统计数据。我不清楚该怎么做。如有任何提示或建议,将不胜感激。我最初的想法是在MetricRegistry
的实例中扩展AggregatingMetricsFactory
铅锤。想法
# 1 楼答案
通过JMX(启用时)启用计数以实现向后兼容性
然而,在使用
@EnableIntegrationManagement
时,不再需要启用JMX来获取统计信息您可以简单地使用
context.getBeansOftype()
获取所有bean(MessageChannelMetrics
,MessageHandlerMetrics
,MessageSourceMetrics
),并通过迭代实例来公开您感兴趣的那些统计信息