【问题标题】:How to send just arbitrary scalar value with Metrics?如何使用 Metrics 发送任意标量值?
【发布时间】:2022-07-12 22:39:52
【问题描述】:

我找不到使用Metrics 发送一些标量值的功能!

Meters 只允许标记时间点。

Gauge通过调用存储函数生成一个值。

Countercn 只增减减。

我可以有实体,让我只发送一些我想要的值吗?

【问题讨论】:

    标签: java metrics dropwizard


    【解决方案1】:

    我想你想要的是一个仪表,例如

    registry.register(name(SessionStore.class, "the-answer"), new Gauge<Integer>() {
        @Override
        public Integer getValue() {
            return 42;
        }
    });
    

    https://metrics.dropwizard.io/4.2.0/manual/core.html#

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-06
      • 1970-01-01
      • 2019-12-29
      • 2021-01-21
      • 2022-12-20
      • 2018-01-30
      • 1970-01-01
      相关资源
      最近更新 更多