apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
https://hugegraph.apache.org
Apache License 2.0
2.65k stars 521 forks source link

[Bug] I can not get metrics from store server #2600

Open shirleyStorage opened 3 months ago

shirleyStorage commented 3 months ago

Bug Type (问题类型)

rest-api (结果不合预期)

Before submit

Environment (环境信息)

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

dosubot[bot] commented 3 months ago

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.