alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.35k stars 12.86k forks source link

Nacos 2.2.0 - Missing enabled Status in Instance Query Response #12850

Closed qq386760345 closed 1 week ago

qq386760345 commented 1 week ago

Issue Summary:

In Nacos 2.2.0, when querying the status of instances via the API, the response does not include the enabled status for the instance. This behavior is inconsistent with the expected functionality where the enabled status should be part of the instance metadata, indicating whether the instance is active or disabled in the registry.

Steps to Reproduce:

Register a service in Nacos 2.2.0. Query the service instance status via the Nacos API (e.g., using GET /v1/ns/instance). Observe that the enabled status is not included in the returned instance data, even though the enabled flag has been set during registration. Example API Request:

{ "code": 0, "message": "success", "data": { "serviceName": "TJPT@@TJZT-AssistCreationService", "ip": "172.31.241.185", "port": 8750, "clusterName": "DEFAULT", "weight": 1.0, "healthy": true, "instanceId": null, "metadata": { "preserved.register.source": "SPRING_CLOUD" } } }

Notice that the enabled field is missing in the actual response.

Expected Behavior:

When querying instance details through Nacos, the enabled field should be present and indicate whether the instance is enabled (true) or disabled (false). This field is critical for understanding the current state of the service instance in the registry, particularly in use cases involving dynamic service control (e.g., enabling/disabling services).

Actual Behavior:

The enabled field is missing from the response when querying instance information, which results in an incomplete picture of the service's current status. The absence of this information hinders the ability to programmatically check if an instance is enabled or not, especially when managing service lifecycle or performing health checks.