【问题标题】:Spring Boot 2 Metrics Last invocation of @Timed Scheduled JobSpring Boot 2 Metrics 最后一次调用@Timed Scheduled Job
【发布时间】:2018-04-17 21:24:21
【问题描述】:

Gradle 依赖项

compile "org.springframework.boot:spring-boot-starter-web:2.0.1.RELEASE"
compile "org.springframework.boot:spring-boot-starter-actuator:2.0.1.RELEASE"
compile "org.springframework.boot:spring-boot-starter-aop:2.0.1.RELEASE"

我的计划任务

@Scheduled(fixedRate = 1000L * 57L)
@Timed("importCustomers")
open fun importCustomers() = importCustomerService.importCustomers()

当通过执行器端点 (http://xxx:yyy/actuator/metrics/importCustomers) 请求作业的指标时,我可以看到调用次数、最长时间和总时间。

有没有办法查看函数被调用的时间戳,或者至少是最近一次调用的时间?

例如,上次运行时间为 2018-04-17T17:00:00.000Z。

【问题讨论】:

    标签: spring spring-boot spring-boot-actuator micrometer


    【解决方案1】:

    micrometer:1.0.3(Spring Boot 2 指标的后备库)不是。此功能的跟踪问题可以在here 找到。

    分享您的用例,或许还有一些提示,说明您将如何或通过何种方式在警报/可视化方面评估此类指标,这将有助于确定一个好的实施方案。例如。建议使用额外的计量指标。

    【讨论】:

      【解决方案2】:

      我使用 Spring AOP 构建了一个示例来跟踪计划的作业,源代码可以在 Github 找到

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-05-23
        • 1970-01-01
        • 2018-07-05
        • 2021-04-30
        • 2020-10-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多