【问题标题】:Spring Integration DSL Gathering Metrics between FlowsSpring Integration DSL 收集流之间的指标
【发布时间】:2018-10-07 08:08:16
【问题描述】:

我正在将 Spring Integration DSL 与 ActiveMQ 与并发消费者一起使用,并尝试调整 Spring IntegrationFlows 的 Metrics,它使用直接通道和路由器相互交互。

典型的集成流程如下所示:

                                                -> InboundFlow1 -> Transformer|
ActiveMQ Broker ->JMS InboundAdapter -> Router |                             -> OutboundFlow -> JMS OutboundAdapter
                                                -> InboundFlow2 -> Transformer|

每个流包含入站 JMS 适配器、路由器、过滤器、转换器和出站 JMS 网关。

有什么方法可以将此类指标从 InboundAdapter 收集到 OutboundAdapter:

  • 每秒的消息量;
  • 消息总量;
  • 通过流的最短传输时间;
  • 通过流的最大传输时间;
  • 通过Flow传输的平均时间;
  • 错误消息的数量;
  • 处理消息的持续时间;

我已经尝试了 MessageChannelMetrics 提出的解决方案:

https://docs.spring.io/spring-integration/reference/html/system-management-chapter.html#mgmt-channel-features https://github.com/spring-projects/spring-integration-samples/tree/master/intermediate/monitoring Spring Integration Channel Statistics Metrics

但它们没有涵盖所需的功能。

【问题讨论】:

    标签: spring-integration spring-integration-dsl


    【解决方案1】:

    除了第一个和最后一个之外的所有内容都存在;第一个可以推导出来;最后一个意味着为每条消息捕获它,这将是昂贵的。

    但是,除了这些标准指标之外,Spring Integration 5.0.4 现在还支持Micrometer

    编辑

    此外,如果标准指标不能满足您的需求docs here,您始终可以添加自定义指标工厂。

    只需编写您自己的 AbstractMessageHandlerMetrics 子类即可捕获您想要的任何内容。

    【讨论】:

    • 感谢Gary的回答,是不是说spring的版本也该更新了?
    • 是的,Spring Integration 5.0.x 需要 Spring Framework 5.0.x。
    • 不幸的是,迁移到 Spring 5 并不像预期的那么简单。您能否添加一个示例,如何计算流程执行的总消耗时间?
    • 我会很感激任何例子。我不知道如何使用弹簧集成示例以最好的方式做到这一点
    • count * (average) duration 请记住,平均持续时间会随着时间和消息而衰减,因此只有在消息到达率和处理时间相当稳定的情况下才会有意义。如果标准指标不能满足您的需求docs here,您可以添加自定义指标工厂。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-10
    • 2017-12-22
    • 2018-03-24
    • 1970-01-01
    相关资源
    最近更新 更多