chore: adapter node metrics query with `cluster_id ` or `cluster uuid` (#28)

This commit is contained in:
silenceqi 2024-12-13 15:12:24 +08:00 committed by GitHub
parent 5a02966f2d
commit 9cb54a3381
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 6 deletions

View File

@ -566,9 +566,23 @@ func (h *APIHandler) GetClusterNodes(w http.ResponseWriter, req *http.Request, p
},
},
{
"term": util.MapStr{
"metadata.labels.cluster_uuid": util.MapStr{
"value": clusterUUID,
"bool": util.MapStr{
"minimum_should_match": 1,
"should": []util.MapStr{
{
"term": util.MapStr{
"metadata.labels.cluster_id": util.MapStr{
"value": id,
},
},
},
{
"term": util.MapStr{
"metadata.labels.cluster_uuid": util.MapStr{
"value": clusterUUID,
},
},
},
},
},
},

View File

@ -117,9 +117,23 @@ func (h *APIHandler) getNodeMetrics(ctx context.Context, clusterID string, bucke
var must = []util.MapStr{
{
"term":util.MapStr{
"metadata.labels.cluster_uuid":util.MapStr{
"value": clusterUUID,
"bool": util.MapStr{
"minimum_should_match": 1,
"should": []util.MapStr{
{
"term": util.MapStr{
"metadata.labels.cluster_id": util.MapStr{
"value": clusterID,
},
},
},
{
"term": util.MapStr{
"metadata.labels.cluster_uuid": util.MapStr{
"value": clusterUUID,
},
},
},
},
},
},