dosubot[bot] commented on issue #2600:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2600#issuecomment-2248067275

   <!-- Answer -->
   The reason you are receiving an empty JSON object when calling the 
`/metrics` endpoint is that the `index()` method mapped to this endpoint 
returns an empty `HashMap`:
   
   ```java
   @GetMapping
   public Map<String, String> index() {
       return new HashMap<>();
   }
   ```
   
   This method is designed to return an empty map, which translates to an empty 
JSON object in the response. In contrast, the `/metrics/drive` endpoint calls 
the `drive()` method, which returns the actual drive metrics data:
   
   ```java
   @GetMapping("drive")
   public Map<String, Map<String, Object>> drive() {
       return this.driveMetrics.metrics();
   }
   ```
   
   This method returns the metrics collected by the `DriveMetrics` class, which 
is why you see data when calling `/metrics/drive` 
<sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/controller/HgStoreMetricsController.java)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to