[monitor] 调整监控参数定义字段,监控参数和监控配置暂时存在内存

This commit is contained in:
tomsun28
2021-11-16 17:47:15 +08:00
parent 2b2c0afbe4
commit 94a44a7f2e
11 changed files with 94 additions and 31 deletions

View File

@@ -68,9 +68,6 @@ public class Metrics {
*/
private JdbcProtocol jdbc;
/**
* todo 替换指标信息
*/
@Data
@AllArgsConstructor
@NoArgsConstructor

View File

@@ -1,7 +1,6 @@
package com.usthe.common.util;
import com.google.protobuf.Message;
import com.google.protobuf.MessageOrBuilder;
import com.google.protobuf.util.JsonFormat;
import lombok.extern.slf4j.Slf4j;
@@ -13,6 +12,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class ProtoJsonUtil {
private static final JsonFormat.Printer PRINTER = JsonFormat.printer();
private static final JsonFormat.Parser PARSER = JsonFormat.parser();
/**
* protobuf 转 json
* @param proto protobuf
@@ -20,7 +22,7 @@ public class ProtoJsonUtil {
*/
public static String toJsonStr(Message proto) {
try {
return JsonFormat.printer().print(proto);
return PRINTER.print(proto);
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
@@ -35,7 +37,7 @@ public class ProtoJsonUtil {
*/
public static Message toProtobuf(String json, Message.Builder builder) {
try {
JsonFormat.parser().merge(json, builder);
PARSER.merge(json, builder);
return builder.build();
} catch (Exception e) {
log.error(e.getMessage(), e);