incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

[Bug] I can not get metrics from store server

Open shirleyStorage opened this issue 2 years ago • 1 comments

Bug Type (问题类型)

rest-api (结果不合预期)

Before submit

  • [X] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version: master branch
  • Backend: Server deployed by Guide doc
  • OS: Mac
  • Data Size: Less than 10 vertices

Expected & Actual behavior (期望与实际表现)

If I call curl "http://localhost:8520/metrics" It just return {}. No metrics are returned.

But call

curl "http://localhost:8520/metrics/drive"

It can return {"/":{"usable_space":89916,"total_space":471482,"free_space":89916,"size_unit":"MB"}}%

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

shirleyStorage avatar Jul 24 '24 14:07 shirleyStorage

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:

@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:

@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 [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Jul 24 '24 14:07 dosubot[bot]