-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Milestone
Description
Describe the bug
In AbstractClient, add Instance will add instance size to monitor count for instance when register batch Instance.
@Override
public boolean addServiceInstance(Service service, InstancePublishInfo instancePublishInfo) {
if (null == publishers.put(service, instancePublishInfo)) {
if (instancePublishInfo instanceof BatchInstancePublishInfo) {
MetricsMonitor.incrementIpCountWithBatchRegister(instancePublishInfo);
} else {
MetricsMonitor.incrementInstanceCount();
}
}
NotifyCenter.publishEvent(new ClientEvent.ClientChangedEvent(this));
Loggers.SRV_LOG.info("Client change for service {}, {}", service, getClientId());
return true;
}But the old only add the size for first time, when batch register second times, the count will not change. And when deregister the batch instance, the count will be more or less decrease.
Expected behavior
Count right.
Actually behavior
maybe count wrong
How to Reproduce
Steps to reproduce the behavior:
- Start any nacos service
- Register any size batch instance
- Register any other size batch instance for same service by same client.
- See the prometheus api and found ipCount is not expected.
- close the client, and the ipCount is not 0.
Desktop (please complete the following information):
- OS: [e.g. Centos]
- Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
- Module [e.g. naming/config]
- SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]
Additional context
Add any other context about the problem here.