Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: correct order within page result #6847

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,7 @@ func (p *ClustersRepo) GetClusterList(ctx context.Context, req model.ClusterList
resp.Total = len(allClusterGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/daemonsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,7 @@ func (d *DaemonSetsRepo) GetDaemonSetList(ctx context.Context, req model.DaemonS
resp.Total = len(allDaemonSetGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,7 @@ func (d *DeploymentsRepo) GetDeploymentList(ctx context.Context, req model.Deplo
resp.Total = len(allDeploymentGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,5 +494,7 @@ func (d *JobsRepo) GetJobList(ctx context.Context, req model.JobListRequest) (mo
resp.Total = len(allJobGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,7 @@ func (p *NamespacesRepo) GetNamespaceList(ctx context.Context, req model.Namespa
resp.Total = len(allNamespaceGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
9 changes: 5 additions & 4 deletions pkg/query-service/app/inframetrics/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (

nodeAttrsToEnrich = []string{"k8s_node_name", "k8s_node_uid", "k8s_cluster_name"}

k8sNodeUIDAttrKey = "k8s_node_uid"
k8sNodeGroupAttrKey = "k8s_node_name"

queryNamesForNodes = map[string][]string{
"cpu": {"A"},
Expand Down Expand Up @@ -125,7 +125,7 @@ func (p *NodesRepo) getMetadataAttributes(ctx context.Context, req model.NodeLis
}
}

nodeUID := stringData[k8sNodeUIDAttrKey]
nodeUID := stringData[k8sNodeGroupAttrKey]
if _, ok := nodeAttrs[nodeUID]; !ok {
nodeAttrs[nodeUID] = map[string]string{}
}
Expand Down Expand Up @@ -220,7 +220,7 @@ func (p *NodesRepo) GetNodeList(ctx context.Context, req model.NodeListRequest)
}

if req.GroupBy == nil {
req.GroupBy = []v3.AttributeKey{{Key: k8sNodeUIDAttrKey}}
req.GroupBy = []v3.AttributeKey{{Key: k8sNodeGroupAttrKey}}
resp.Type = model.ResponseTypeList
} else {
resp.Type = model.ResponseTypeGroupedList
Expand Down Expand Up @@ -306,7 +306,7 @@ func (p *NodesRepo) GetNodeList(ctx context.Context, req model.NodeListRequest)
NodeMemoryAllocatable: -1,
}

if nodeUID, ok := row.Data[k8sNodeUIDAttrKey].(string); ok {
if nodeUID, ok := row.Data[k8sNodeGroupAttrKey].(string); ok {
record.NodeUID = nodeUID
}

Expand Down Expand Up @@ -354,5 +354,6 @@ func (p *NodesRepo) GetNodeList(ctx context.Context, req model.NodeListRequest)
resp.Total = len(allNodeGroups)
resp.Records = records

resp.SortBy(req.OrderBy)
return resp, nil
}
12 changes: 6 additions & 6 deletions pkg/query-service/app/inframetrics/nodes_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
},
GroupBy: []v3.AttributeKey{
{
Key: k8sNodeUIDAttrKey,
Key: k8sNodeGroupAttrKey,
DataType: v3.AttributeKeyDataTypeString,
Type: v3.AttributeKeyTypeResource,
},
Expand All @@ -46,7 +46,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
},
GroupBy: []v3.AttributeKey{
{
Key: k8sNodeUIDAttrKey,
Key: k8sNodeGroupAttrKey,
DataType: v3.AttributeKeyDataTypeString,
Type: v3.AttributeKeyTypeResource,
},
Expand All @@ -72,7 +72,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
},
GroupBy: []v3.AttributeKey{
{
Key: k8sNodeUIDAttrKey,
Key: k8sNodeGroupAttrKey,
DataType: v3.AttributeKeyDataTypeString,
Type: v3.AttributeKeyTypeResource,
},
Expand All @@ -98,7 +98,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
},
GroupBy: []v3.AttributeKey{
{
Key: k8sNodeUIDAttrKey,
Key: k8sNodeGroupAttrKey,
DataType: v3.AttributeKeyDataTypeString,
Type: v3.AttributeKeyTypeResource,
},
Expand Down Expand Up @@ -132,7 +132,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
},
GroupBy: []v3.AttributeKey{
{
Key: k8sNodeUIDAttrKey,
Key: k8sNodeGroupAttrKey,
DataType: v3.AttributeKeyDataTypeString,
Type: v3.AttributeKeyTypeResource,
},
Expand Down Expand Up @@ -166,7 +166,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
},
GroupBy: []v3.AttributeKey{
{
Key: k8sNodeUIDAttrKey,
Key: k8sNodeGroupAttrKey,
DataType: v3.AttributeKeyDataTypeString,
Type: v3.AttributeKeyTypeResource,
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,5 +404,7 @@ func (p *PodsRepo) GetPodList(ctx context.Context, req model.PodListRequest) (mo
resp.Total = len(allPodGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/pvcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,7 @@ func (p *PvcsRepo) GetPvcList(ctx context.Context, req model.VolumeListRequest)
resp.Total = len(allVolumeGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/query-service/app/inframetrics/statefulsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,7 @@ func (d *StatefulSetsRepo) GetStatefulSetList(ctx context.Context, req model.Sta
resp.Total = len(allStatefulSetGroups)
resp.Records = records

resp.SortBy(req.OrderBy)

return resp, nil
}
Loading
Loading