SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: correct order within page result (#6847)
Srikanth Chekuri89541862cc5b
diff --git a/pkg/query-service/app/inframetrics/clusters.go b/pkg/query-service/app/inframetrics/clusters.goindex 70ef5ca95a..d6af7ef09a 100644--- a/pkg/query-service/app/inframetrics/clusters.go+++ b/pkg/query-service/app/inframetrics/clusters.go@@ -338,5 +338,7 @@ func (p *ClustersRepo) GetClusterList(ctx context.Context, req model.ClusterListresp.Total = len(allClusterGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/app/inframetrics/daemonsets.go b/pkg/query-service/app/inframetrics/daemonsets.goindex 735d52d2a0..05f4c1b9ab 100644--- a/pkg/query-service/app/inframetrics/daemonsets.go+++ b/pkg/query-service/app/inframetrics/daemonsets.go@@ -440,5 +440,7 @@ func (d *DaemonSetsRepo) GetDaemonSetList(ctx context.Context, req model.DaemonSresp.Total = len(allDaemonSetGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/app/inframetrics/deployments.go b/pkg/query-service/app/inframetrics/deployments.goindex aed8de1929..691447c509 100644--- a/pkg/query-service/app/inframetrics/deployments.go+++ b/pkg/query-service/app/inframetrics/deployments.go@@ -440,5 +440,7 @@ func (d *DeploymentsRepo) GetDeploymentList(ctx context.Context, req model.Deploresp.Total = len(allDeploymentGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/app/inframetrics/jobs.go b/pkg/query-service/app/inframetrics/jobs.goindex 42300f0b87..508a0014fb 100644--- a/pkg/query-service/app/inframetrics/jobs.go+++ b/pkg/query-service/app/inframetrics/jobs.go@@ -494,5 +494,7 @@ func (d *JobsRepo) GetJobList(ctx context.Context, req model.JobListRequest) (moresp.Total = len(allJobGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/app/inframetrics/namespaces.go b/pkg/query-service/app/inframetrics/namespaces.goindex 9cc1e65d6d..2e111aaeca 100644--- a/pkg/query-service/app/inframetrics/namespaces.go+++ b/pkg/query-service/app/inframetrics/namespaces.go@@ -341,5 +341,7 @@ func (p *NamespacesRepo) GetNamespaceList(ctx context.Context, req model.Namesparesp.Total = len(allNamespaceGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/app/inframetrics/nodes.go b/pkg/query-service/app/inframetrics/nodes.goindex 0aa40552c6..2bac5dd212 100644--- a/pkg/query-service/app/inframetrics/nodes.go+++ b/pkg/query-service/app/inframetrics/nodes.go@@ -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"},@@ -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{}}@@ -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@@ -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}@@ -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}diff --git a/pkg/query-service/app/inframetrics/nodes_query.go b/pkg/query-service/app/inframetrics/nodes_query.goindex 60754b3e98..2dbb9df27b 100644--- a/pkg/query-service/app/inframetrics/nodes_query.go+++ b/pkg/query-service/app/inframetrics/nodes_query.go@@ -20,7 +20,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{},GroupBy: []v3.AttributeKey{{- Key: k8sNodeUIDAttrKey,+ Key: k8sNodeGroupAttrKey,DataType: v3.AttributeKeyDataTypeString,Type: v3.AttributeKeyTypeResource,},@@ -46,7 +46,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{},GroupBy: []v3.AttributeKey{{- Key: k8sNodeUIDAttrKey,+ Key: k8sNodeGroupAttrKey,DataType: v3.AttributeKeyDataTypeString,Type: v3.AttributeKeyTypeResource,},@@ -72,7 +72,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{},GroupBy: []v3.AttributeKey{{- Key: k8sNodeUIDAttrKey,+ Key: k8sNodeGroupAttrKey,DataType: v3.AttributeKeyDataTypeString,Type: v3.AttributeKeyTypeResource,},@@ -98,7 +98,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{},GroupBy: []v3.AttributeKey{{- Key: k8sNodeUIDAttrKey,+ Key: k8sNodeGroupAttrKey,DataType: v3.AttributeKeyDataTypeString,Type: v3.AttributeKeyTypeResource,},@@ -132,7 +132,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{},GroupBy: []v3.AttributeKey{{- Key: k8sNodeUIDAttrKey,+ Key: k8sNodeGroupAttrKey,DataType: v3.AttributeKeyDataTypeString,Type: v3.AttributeKeyTypeResource,},@@ -166,7 +166,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{},GroupBy: []v3.AttributeKey{{- Key: k8sNodeUIDAttrKey,+ Key: k8sNodeGroupAttrKey,DataType: v3.AttributeKeyDataTypeString,Type: v3.AttributeKeyTypeResource,},diff --git a/pkg/query-service/app/inframetrics/pods.go b/pkg/query-service/app/inframetrics/pods.goindex ac96286fd8..ce5bcfbd71 100644--- a/pkg/query-service/app/inframetrics/pods.go+++ b/pkg/query-service/app/inframetrics/pods.go@@ -404,5 +404,7 @@ func (p *PodsRepo) GetPodList(ctx context.Context, req model.PodListRequest) (moresp.Total = len(allPodGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/app/inframetrics/pvcs.go b/pkg/query-service/app/inframetrics/pvcs.goindex 9eb41190ed..c353dd9464 100644--- a/pkg/query-service/app/inframetrics/pvcs.go+++ b/pkg/query-service/app/inframetrics/pvcs.go@@ -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}diff --git a/pkg/query-service/app/inframetrics/statefulsets.go b/pkg/query-service/app/inframetrics/statefulsets.goindex 2d5d6d8313..f44ca77b6f 100644--- a/pkg/query-service/app/inframetrics/statefulsets.go+++ b/pkg/query-service/app/inframetrics/statefulsets.go@@ -440,5 +440,7 @@ func (d *StatefulSetsRepo) GetStatefulSetList(ctx context.Context, req model.Staresp.Total = len(allStatefulSetGroups)resp.Records = records+ resp.SortBy(req.OrderBy)+return resp, nil}diff --git a/pkg/query-service/model/infra.go b/pkg/query-service/model/infra.goindex 24728d349c..3c34e64a04 100644--- a/pkg/query-service/model/infra.go+++ b/pkg/query-service/model/infra.go@@ -114,6 +114,47 @@ type PodListResponse struct {Total int `json:"total"`}+func (r *PodListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].PodCPU > r.Records[j].PodCPU+ })+ case "cpu_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].PodCPURequest > r.Records[j].PodCPURequest+ })+ case "cpu_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].PodCPULimit > r.Records[j].PodCPULimit+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].PodMemory > r.Records[j].PodMemory+ })+ case "memory_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].PodMemoryRequest > r.Records[j].PodMemoryRequest+ })+ case "memory_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].PodMemoryLimit > r.Records[j].PodMemoryLimit+ })+ case "restarts":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].RestartCount > r.Records[j].RestartCount+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type PodListRecord struct {PodUID string `json:"podUID,omitempty"`PodCPU float64 `json:"podCPU"`@@ -151,6 +192,35 @@ type NodeListResponse struct {Total int `json:"total"`}+func (r *NodeListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].NodeCPUUsage > r.Records[j].NodeCPUUsage+ })+ case "cpu_allocatable":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].NodeCPUAllocatable > r.Records[j].NodeCPUAllocatable+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].NodeMemoryUsage > r.Records[j].NodeMemoryUsage+ })+ case "memory_allocatable":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].NodeMemoryAllocatable > r.Records[j].NodeMemoryAllocatable+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type NodeCountByCondition struct {Ready int `json:"ready"`NotReady int `json:"notReady"`@@ -183,6 +253,31 @@ type NamespaceListResponse struct {Total int `json:"total"`}+func (r *NamespaceListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUUsage > r.Records[j].CPUUsage+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryUsage > r.Records[j].MemoryUsage+ })+ case "pod_phase":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CountByPhase.Pending > r.Records[j].CountByPhase.Pending+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type NamespaceListRecord struct {NamespaceName string `json:"namespaceName"`CPUUsage float64 `json:"cpuUsage"`@@ -207,6 +302,35 @@ type ClusterListResponse struct {Total int `json:"total"`}+func (r *ClusterListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUUsage > r.Records[j].CPUUsage+ })+ case "cpu_allocatable":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUAllocatable > r.Records[j].CPUAllocatable+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryUsage > r.Records[j].MemoryUsage+ })+ case "memory_allocatable":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryAllocatable > r.Records[j].MemoryAllocatable+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type ClusterListRecord struct {ClusterUID string `json:"clusterUID"`CPUUsage float64 `json:"cpuUsage"`@@ -232,6 +356,55 @@ type DeploymentListResponse struct {Total int `json:"total"`}+func (r *DeploymentListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUUsage > r.Records[j].CPUUsage+ })+ case "cpu_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPURequest > r.Records[j].CPURequest+ })+ case "cpu_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPULimit > r.Records[j].CPULimit+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryUsage > r.Records[j].MemoryUsage+ })+ case "memory_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryRequest > r.Records[j].MemoryRequest+ })+ case "memory_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryLimit > r.Records[j].MemoryLimit+ })+ case "desired_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].DesiredPods > r.Records[j].DesiredPods+ })+ case "available_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].AvailablePods > r.Records[j].AvailablePods+ })+ case "restarts":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].Restarts > r.Records[j].Restarts+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type DeploymentListRecord struct {DeploymentName string `json:"deploymentName"`CPUUsage float64 `json:"cpuUsage"`@@ -262,6 +435,55 @@ type DaemonSetListResponse struct {Total int `json:"total"`}+func (r *DaemonSetListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUUsage > r.Records[j].CPUUsage+ })+ case "cpu_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPURequest > r.Records[j].CPURequest+ })+ case "cpu_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPULimit > r.Records[j].CPULimit+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryUsage > r.Records[j].MemoryUsage+ })+ case "memory_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryRequest > r.Records[j].MemoryRequest+ })+ case "memory_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryLimit > r.Records[j].MemoryLimit+ })+ case "restarts":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].Restarts > r.Records[j].Restarts+ })+ case "desired_nodes":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].DesiredNodes > r.Records[j].DesiredNodes+ })+ case "available_nodes":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].AvailableNodes > r.Records[j].AvailableNodes+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type DaemonSetListRecord struct {DaemonSetName string `json:"daemonSetName"`CPUUsage float64 `json:"cpuUsage"`@@ -292,6 +514,55 @@ type StatefulSetListResponse struct {Total int `json:"total"`}+func (r *StatefulSetListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUUsage > r.Records[j].CPUUsage+ })+ case "cpu_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPURequest > r.Records[j].CPURequest+ })+ case "cpu_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPULimit > r.Records[j].CPULimit+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryUsage > r.Records[j].MemoryUsage+ })+ case "memory_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryRequest > r.Records[j].MemoryRequest+ })+ case "memory_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryLimit > r.Records[j].MemoryLimit+ })+ case "restarts":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].Restarts > r.Records[j].Restarts+ })+ case "desired_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].DesiredPods > r.Records[j].DesiredPods+ })+ case "available_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].AvailablePods > r.Records[j].AvailablePods+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type StatefulSetListRecord struct {StatefulSetName string `json:"statefulSetName"`CPUUsage float64 `json:"cpuUsage"`@@ -322,6 +593,63 @@ type JobListResponse struct {Total int `json:"total"`}+func (r *JobListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "cpu":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPUUsage > r.Records[j].CPUUsage+ })+ case "cpu_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPURequest > r.Records[j].CPURequest+ })+ case "cpu_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].CPULimit > r.Records[j].CPULimit+ })+ case "memory":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryUsage > r.Records[j].MemoryUsage+ })+ case "memory_request":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryRequest > r.Records[j].MemoryRequest+ })+ case "memory_limit":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].MemoryLimit > r.Records[j].MemoryLimit+ })+ case "restarts":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].Restarts > r.Records[j].Restarts+ })+ case "desired_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].DesiredSuccessfulPods > r.Records[j].DesiredSuccessfulPods+ })+ case "active_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].ActivePods > r.Records[j].ActivePods+ })+ case "failed_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].FailedPods > r.Records[j].FailedPods+ })+ case "successful_pods":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].SuccessfulPods > r.Records[j].SuccessfulPods+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type JobListRecord struct {JobName string `json:"jobName"`CPUUsage float64 `json:"cpuUsage"`@@ -354,6 +682,43 @@ type VolumeListResponse struct {Total int `json:"total"`}+func (r *VolumeListResponse) SortBy(orderBy *v3.OrderBy) {+ switch orderBy.ColumnName {+ case "available":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].VolumeAvailable > r.Records[j].VolumeAvailable+ })+ case "capacity":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].VolumeCapacity > r.Records[j].VolumeCapacity+ })+ case "usage":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].VolumeUsage > r.Records[j].VolumeUsage+ })+ case "inodes":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].VolumeInodes > r.Records[j].VolumeInodes+ })+ case "inodes_free":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].VolumeInodesFree > r.Records[j].VolumeInodesFree+ })+ case "inodes_used":+ sort.Slice(r.Records, func(i, j int) bool {+ return r.Records[i].VolumeInodesUsed > r.Records[j].VolumeInodesUsed+ })+ }++ // the default is descending+ if orderBy.Order == v3.DirectionAsc {+ // reverse the list+ for i, j := 0, len(r.Records)-1; i < j; i, j = i+1, j-1 {+ r.Records[i], r.Records[j] = r.Records[j], r.Records[i]+ }+ }+}+type VolumeListRecord struct {PersistentVolumeClaimName string `json:"persistentVolumeClaimName"`VolumeAvailable float64 `json:"volumeAvailable"`