Add node rps and concurrents to FizzGatewayNodeStatSchedConfig.java

This commit is contained in:
hongqiaowei
2022-08-06 11:01:37 +08:00
parent e171905c6d
commit 2838bc418b

View File

@@ -54,8 +54,8 @@ public class FizzGatewayNodeStatSchedConfig extends SchedConfig {
public int port; public int port;
public long ts; public long ts;
public long startTs; public long startTs;
public long concurrents = 0; public long concurrents;
public double rps = 0; public double rps;
} }
private static final Logger LOGGER = LoggerFactory.getLogger(FizzGatewayNodeStatSchedConfig.class); private static final Logger LOGGER = LoggerFactory.getLogger(FizzGatewayNodeStatSchedConfig.class);
@@ -74,7 +74,7 @@ public class FizzGatewayNodeStatSchedConfig extends SchedConfig {
@Autowired(required = false) @Autowired(required = false)
private FlowStat flowStat; private FlowStat flowStat;
@Value("${izz-gateway-node-stat-sched.recent:3}") @Value("${izz-gateway-node-stat-sched.recent:1}")
private int recent; private int recent;
private Stat stat = new Stat(); private Stat stat = new Stat();
@@ -95,6 +95,7 @@ public class FizzGatewayNodeStatSchedConfig extends SchedConfig {
public void sched() { public void sched() {
stat.ts = System.currentTimeMillis(); stat.ts = System.currentTimeMillis();
if (flowControl) { if (flowControl) {
stat.rps = 0;
long currentTimeSlot = flowStat.currentTimeSlotId(); long currentTimeSlot = flowStat.currentTimeSlotId();
long startTimeSlot = currentTimeSlot - recent * 1000; long startTimeSlot = currentTimeSlot - recent * 1000;
List<ResourceTimeWindowStat> resourceTimeWindowStats = flowStat.getResourceTimeWindowStats(ResourceIdUtils.NODE_RESOURCE, startTimeSlot, currentTimeSlot, recent); List<ResourceTimeWindowStat> resourceTimeWindowStats = flowStat.getResourceTimeWindowStats(ResourceIdUtils.NODE_RESOURCE, startTimeSlot, currentTimeSlot, recent);