Skip to content

Commit

Permalink
Develop refactor topn (#11352)
Browse files Browse the repository at this point in the history
* Move topn to core module.

* StringTopNCounter replace TopnCounterMetricsContainer.java

* Use ServiceTopNCounter replace StringTopNCounterTest for naming.

* Use FixedSizePriorityQueue replace PriorityQueue to save memory.

* For PMD.
  • Loading branch information
KomachiSion authored Nov 9, 2023
1 parent 0d46af0 commit e77a0bb
Show file tree
Hide file tree
Showing 14 changed files with 609 additions and 347 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public void refreshTopnConfigChangeCount() {
*/
@Scheduled(cron = "0 0 0 ? * 1")
public void resetTopnConfigChangeCount() {
MetricsMonitor.getConfigChangeCount().removeAll();
MetricsMonitor.getConfigChangeCount().reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.alibaba.nacos.config.server.monitor;

import com.alibaba.nacos.common.utils.TopnCounterMetricsContainer;
import com.alibaba.nacos.core.monitor.NacosMeterRegistryCenter;
import com.alibaba.nacos.core.monitor.topn.StringTopNCounter;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.ImmutableTag;
import io.micrometer.core.instrument.Tag;
Expand Down Expand Up @@ -73,7 +73,7 @@ public class MetricsMonitor {
/**
* config change count.
*/
private static TopnCounterMetricsContainer configChangeCount = new TopnCounterMetricsContainer();
private static StringTopNCounter configChangeCount = new StringTopNCounter();

static {
ImmutableTag immutableTag = new ImmutableTag("module", "config");
Expand Down Expand Up @@ -166,7 +166,7 @@ public static AtomicInteger getConfigSubscriberMonitor(String version) {
return configSubscriber.get(version);
}

public static TopnCounterMetricsContainer getConfigChangeCount() {
public static StringTopNCounter getConfigChangeCount() {
return configChangeCount;
}

Expand Down
Loading

0 comments on commit e77a0bb

Please sign in to comment.