feat(monitor): 增加指标输出模块

一些外部指标查询通过指标输出模块输出,避免对原业务模块产生影响
This commit is contained in:
2024-03-05 12:21:38 +08:00
parent 41d5a6b264
commit d4e161459a
14 changed files with 355 additions and 12 deletions

View File

@@ -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
));