feat(monitor): 增加指标输出模块
一些外部指标查询通过指标输出模块输出,避免对原业务模块产生影响
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.lanyuanxiaoyao.service.queue.controller;
|
||||
|
||||
import com.lanyuanxiaoyao.service.common.Constants;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.Tag;
|
||||
import java.util.Collection;
|
||||
@@ -17,10 +18,10 @@ public abstract class QueueOperator {
|
||||
|
||||
protected void updateMetrics(MeterRegistry registry, String name, Map<String, ? extends Collection<?>> map) {
|
||||
map.forEach((queue, collection) -> registry.gaugeCollectionSize(
|
||||
"service_queue_size",
|
||||
Constants.METRICS_QUEUE_SIZE,
|
||||
Lists.immutable.of(
|
||||
Tag.of("type", name),
|
||||
Tag.of("name", queue)
|
||||
Tag.of(Constants.METRICS_LABEL_TYPE, name),
|
||||
Tag.of(Constants.METRICS_LABEL_NAME, queue)
|
||||
),
|
||||
collection
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user