Skip to content

Commit

Permalink
chore: adapter node metrics query with cluster_id or cluster uuid (
Browse files Browse the repository at this point in the history
  • Loading branch information
silenceqi authored Dec 13, 2024
1 parent 5a02966 commit 9cb54a3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
20 changes: 17 additions & 3 deletions modules/elastic/api/cluster_overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
},
},
},
Expand Down
20 changes: 17 additions & 3 deletions modules/elastic/api/node_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
},
},
},
Expand Down

0 comments on commit 9cb54a3

Please sign in to comment.