From 3ebee57ce8829b011ba6718629061fa8138b92d9 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Kolamuri Date: Mon, 7 Apr 2025 17:25:24 +0530 Subject: [PATCH 1/3] Add generic api's for filtering, pagination in getAllConfigs call --- .../config/service/v1/config_service.proto | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto b/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto index 24c43262..c80f5124 100644 --- a/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto +++ b/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto @@ -88,11 +88,29 @@ message GetAllConfigsRequest { // required - namespace with which the config resource is associated string resource_namespace = 2; + + // optional - filtering criteria to narrow down the configs. + // Supports relational and logical operators on config fields. + optional Filter filter = 3; + + // optional - list of sorting conditions to order the results. + // Multiple SortBy entries are applied in the specified order of priority. + repeated SortBy sort_by = 4; + + // optional - pagination parameters to limit and offset the result set. + // Useful for retrieving configs in pages when total count is large. + optional Pagination pagination = 5; } message GetAllConfigsResponse { // list of config values along with the associated contexts, sorted in the descending order of their creation time repeated ContextSpecificConfig context_specific_configs = 1; + + // Total number of records matching the filter before pagination + int32 total_count = 2; + + // next offset to use for pagination + int32 next_offset = 3; } message ContextSpecificConfig { @@ -201,3 +219,25 @@ enum LogicalOperator { LOGICAL_OPERATOR_AND = 1; LOGICAL_OPERATOR_OR = 2; } + +message SortBy { + Selection selection = 1; + SortOrder sort_order = 2; +} + +message Pagination { + int32 limit = 1; + int32 offset = 2; +} + +message Selection { + oneof type { + string config_json_path = 1; + } +} + +enum SortOrder { + SORT_ORDER_UNSPECIFIED = 0; + SORT_ORDER_ASC = 1; + SORT_ORDER_DESC = 2; +} From 6c210448e638ae3ec9d0befbe7c2266dec253b2f Mon Sep 17 00:00:00 2001 From: Pavan Kumar Kolamuri Date: Mon, 7 Apr 2025 21:55:51 +0530 Subject: [PATCH 2/3] Addressed comments --- .../config/service/v1/config_service.proto | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto b/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto index c80f5124..afc3930e 100644 --- a/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto +++ b/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto @@ -91,7 +91,7 @@ message GetAllConfigsRequest { // optional - filtering criteria to narrow down the configs. // Supports relational and logical operators on config fields. - optional Filter filter = 3; + Filter filter = 3; // optional - list of sorting conditions to order the results. // Multiple SortBy entries are applied in the specified order of priority. @@ -99,18 +99,18 @@ message GetAllConfigsRequest { // optional - pagination parameters to limit and offset the result set. // Useful for retrieving configs in pages when total count is large. - optional Pagination pagination = 5; + Pagination pagination = 5; + + // optional - include total count in the response + bool include_total = 6; } message GetAllConfigsResponse { // list of config values along with the associated contexts, sorted in the descending order of their creation time repeated ContextSpecificConfig context_specific_configs = 1; - // Total number of records matching the filter before pagination + // Total number of records matching the filter before pagination if include_total is true. int32 total_count = 2; - - // next offset to use for pagination - int32 next_offset = 3; } message ContextSpecificConfig { From b10aa5794f501c791acc963cae66e8f2bfe984ed Mon Sep 17 00:00:00 2001 From: Pavan Kumar Kolamuri Date: Tue, 8 Apr 2025 09:00:43 +0530 Subject: [PATCH 3/3] Make total count optional --- .../proto/org/hypertrace/config/service/v1/config_service.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto b/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto index afc3930e..30cddf0a 100644 --- a/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto +++ b/config-service-api/src/main/proto/org/hypertrace/config/service/v1/config_service.proto @@ -110,7 +110,7 @@ message GetAllConfigsResponse { repeated ContextSpecificConfig context_specific_configs = 1; // Total number of records matching the filter before pagination if include_total is true. - int32 total_count = 2; + optional int32 total_count = 2; } message ContextSpecificConfig {