Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE#5697]Add new indicator for core module, especially Jraft and Distro protocal. #7003

Merged
merged 3 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public Object interfacePublishSingleRpc(ProceedingJoinPoint pjp, ConfigPublishRe
throws Throwable {
final String md5 =
request.getContent() == null ? null : MD5Utils.md5Hex(request.getContent(), Constants.ENCODE);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_PUBLISH)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.PUBLISH)
.incrementAndGet();
return logClientRequestRpc("publish", pjp, request, meta, request.getDataId(), request.getGroup(),
request.getTenant(), md5);
Expand All @@ -125,9 +125,9 @@ public Object interfacePublishSingleRpc(ProceedingJoinPoint pjp, ConfigPublishRe
public Object interfacePublishSingle(ProceedingJoinPoint pjp, HttpServletRequest request,
HttpServletResponse response, String dataId, String group, String tenant, String content) throws Throwable {
final String md5 = content == null ? null : MD5Utils.md5Hex(content, Constants.ENCODE);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_PUBLISH)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.PUBLISH)
.incrementAndGet();
return logClientRequest("publish", pjp, request, response, dataId, group, tenant, md5);
}
Expand Down Expand Up @@ -159,9 +159,9 @@ public Object interfaceGetConfig(ProceedingJoinPoint pjp, HttpServletRequest req
String dataId, String group, String tenant) throws Throwable {
final String groupKey = GroupKey2.getKey(dataId, group, tenant);
final String md5 = ConfigCacheService.getContentMd5(groupKey);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_GET_CONFIG)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.GET_CONFIG)
.incrementAndGet();
return logClientRequest("get", pjp, request, response, dataId, group, tenant, md5);
}
Expand All @@ -174,9 +174,9 @@ public Object interfaceGetConfigRpc(ProceedingJoinPoint pjp, ConfigQueryRequest
throws Throwable {
final String groupKey = GroupKey2.getKey(request.getDataId(), request.getGroup(), request.getTenant());
final String md5 = ConfigCacheService.getContentMd5(groupKey);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_GET_CONFIG)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.GET_CONFIG)
.incrementAndGet();
return logClientRequestRpc("get", pjp, request, meta, request.getDataId(), request.getGroup(),
request.getTenant(), md5);
Expand Down Expand Up @@ -224,9 +224,9 @@ private Object logClientRequestRpc(String requestType, ProceedingJoinPoint pjp,
@Around(CLIENT_INTERFACE_LISTEN_CONFIG_RPC)
public Object interfaceListenConfigRpc(ProceedingJoinPoint pjp, ConfigBatchListenRequest request,
RequestMeta meta) throws Throwable {
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_GET_CONFIG)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.GET_CONFIG)
.incrementAndGet();
final String requestIp = meta.getClientIp();
String appName = request.getHeader(RequestUtil.CLIENT_APPNAME_HEADER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(IllegalArgumentException.class)
public ResponseEntity<String> handleIllegalArgumentException(Exception ex) throws IOException {
MetricsManager.counter(ConfigMetricsConstant.N_NACOS_EXCEPTION,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_ILLEGAL_ARGUMENT)
MetricsManager.counter(ConfigMetricsConstant.NACOS_EXCEPTION,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.ILLEGAL_ARGUMENT)
.increment();
return ResponseEntity.status(400).body(ExceptionUtil.getAllExceptionMsg(ex));
}
Expand All @@ -57,9 +57,9 @@ public ResponseEntity<String> handleIllegalArgumentException(Exception ex) throw
*/
@ExceptionHandler(NacosException.class)
public ResponseEntity<String> handleNacosException(NacosException ex) throws IOException {
MetricsManager.counter(ConfigMetricsConstant.N_NACOS_EXCEPTION,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_NACOS)
MetricsManager.counter(ConfigMetricsConstant.NACOS_EXCEPTION,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.NACOS)
.increment();
return ResponseEntity.status(ex.getErrCode()).body(ExceptionUtil.getAllExceptionMsg(ex));
}
Expand All @@ -71,9 +71,9 @@ public ResponseEntity<String> handleNacosException(NacosException ex) throws IOE
*/
@ExceptionHandler(DataAccessException.class)
public ResponseEntity<String> handleDataAccessException(DataAccessException ex) throws DataAccessException {
MetricsManager.counter(ConfigMetricsConstant.N_NACOS_EXCEPTION,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_DB)
MetricsManager.counter(ConfigMetricsConstant.NACOS_EXCEPTION,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.DB)
.increment();
return ResponseEntity.status(500).body(ExceptionUtil.getAllExceptionMsg(ex));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,28 @@ public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
@Override
public void addTask(Object key, AbstractDelayTask newTask) {
super.addTask(key, newTask);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_DUMP_TASK)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.DUMP_TASK)
.set(tasks.size());
}

@Override
public AbstractDelayTask removeTask(Object key) {
AbstractDelayTask result = super.removeTask(key);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_DUMP_TASK)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.DUMP_TASK)
.set(tasks.size());
return result;
}

@Override
protected void processTasks() {
super.processTasks();
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_DUMP_TASK)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.DUMP_TASK)
.set(tasks.size());
if (tasks.isEmpty()) {
this.lock.lock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public MemoryMonitor(AsyncNotifyService notifySingleService) {
*/
@Scheduled(cron = "0 0 0 * * ?")
public void clear() {
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_GET_CONFIG)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.GET_CONFIG)
.set(0);

MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_PUBLISH)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.PUBLISH)
.set(0);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public void run() {
long subCount = ClientTrackService.subscriberCount();
MEMORY_LOG.info("groupCount = {}, subscriberClientCount = {}, subscriberCount = {}", groupCount, subClientCount,
subCount);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_CONFIG_COUNT).set(groupCount);
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.CONFIG_COUNT).set(groupCount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public void run() {
int notifierClientSize = ConfigExecutor.asyncCofigChangeClientNotifyQueueSize();
MEMORY_LOG.info("toNotifyTaskSize = {}", size);
MEMORY_LOG.info("toClientNotifyTaskSize = {}", notifierClientSize);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_NOTIFY_TASK)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.NOTIFY_TASK)
.set(size);
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_NOTIFY_CLIENT_TASK)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.NOTIFY_CLIENT_TASK)
.set(notifierClientSize);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ class StatTask implements Runnable {
@Override
public void run() {
MEMORY_LOG.info("[long-pulling] client count " + allSubs.size());
MetricsManager.gauge(ConfigMetricsConstant.N_NACOS_MONITOR,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_LONG_POLLING)
MetricsManager.gauge(ConfigMetricsConstant.NACOS_MONITOR,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.LONG_POLLING)
.set(allSubs.size());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ public void run() {

if (!isFound) {
FATAL_LOG.error("[master-db] master db not found.");
MetricsManager.counter(ConfigMetricsConstant.N_NACOS_EXCEPTION,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_DB)
MetricsManager.counter(ConfigMetricsConstant.NACOS_EXCEPTION,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.DB)
.increment();
}
}
Expand Down Expand Up @@ -259,9 +259,9 @@ public void run() {
}
isHealthList.set(i, Boolean.FALSE);

MetricsManager.counter(ConfigMetricsConstant.N_NACOS_EXCEPTION,
ConfigMetricsConstant.TK_MODULE, ConfigMetricsConstant.TV_CONFIG,
ConfigMetricsConstant.TK_NAME, ConfigMetricsConstant.TV_DB)
MetricsManager.counter(ConfigMetricsConstant.NACOS_EXCEPTION,
ConfigMetricsConstant.MODULE, ConfigMetricsConstant.CONFIG,
ConfigMetricsConstant.NAME, ConfigMetricsConstant.DB)
.increment();
}
}
Expand Down
Loading