diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/GFlagsValidationUiOnlyController.java b/managed/src/main/java/com/yugabyte/yw/controllers/GFlagsValidationUiOnlyController.java index 40266cea0f91..4dc3c56940cb 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/GFlagsValidationUiOnlyController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/GFlagsValidationUiOnlyController.java @@ -42,10 +42,16 @@ public class GFlagsValidationUiOnlyController extends AuthenticatedController { responseContainer = "List") @YbaApi(visibility = YbaApi.YbaApiVisibility.PREVIEW, sinceYBAVersion = "2.20.9.0") @AuthzPath - public Result listGFlags(String version, String gflag, String serverType, Boolean mostUsedGFlags) + public Result listGFlags( + String version, + String gflag, + String serverType, + Boolean mostUsedGFlags, + Boolean showExperimental) throws IOException { return PlatformResults.withData( - gflagsValidationHandler.listGFlags(version, gflag, serverType, mostUsedGFlags)); + gflagsValidationHandler.listGFlags( + version, gflag, serverType, mostUsedGFlags, showExperimental)); } /** diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/GFlagsValidationHandler.java b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/GFlagsValidationHandler.java index b77e7dc4ba3a..e2f7b31b40ff 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/GFlagsValidationHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/GFlagsValidationHandler.java @@ -45,6 +45,9 @@ public class GFlagsValidationHandler { public static final Set GFLAGS_FILTER_TAGS = ImmutableSet.of("experimental", "hidden", "auto"); + public static final Set GFLAGS_FILTER_TAGS_ALLOW_EXPERIMENTAL = + ImmutableSet.of("hidden", "auto"); + public static final Set GFLAGS_FILTER_PATTERN = ImmutableSet.of( Pattern.compile("^.*_test.*$", CASE_INSENSITIVE), @@ -68,12 +71,17 @@ public class GFlagsValidationHandler { .build(); public List listGFlags( - String version, String gflag, String serverType, Boolean mostUsedGFlags) throws IOException { + String version, + String gflag, + String serverType, + Boolean mostUsedGFlags, + Boolean showExperimental) + throws IOException { validateServerType(serverType); validateVersionFormat(version); List gflagsList = gflagsValidation.extractGFlags(version, serverType, mostUsedGFlags); - gflagsList = filterGFlagsList(gflagsList); + gflagsList = filterGFlagsList(gflagsList, showExperimental); if (StringUtils.isEmpty(gflag)) { return gflagsList; } @@ -266,7 +274,8 @@ private void validateServerType(String serverType) throws PlatformServiceExcepti } } - private List filterGFlagsList(List gflagsList) { + private List filterGFlagsList( + List gflagsList, Boolean showExperimental) { return gflagsList.stream() .filter( flag -> @@ -275,7 +284,9 @@ private List filterGFlagsList(List gflagsList) { regexMatcher -> !StringUtils.isEmpty(flag.name) && regexMatcher.matcher(flag.name).find()) - && !GFLAGS_FILTER_TAGS.stream() + && !(showExperimental + ? GFLAGS_FILTER_TAGS_ALLOW_EXPERIMENTAL.stream() + : GFLAGS_FILTER_TAGS.stream()) .anyMatch( tags -> !StringUtils.isEmpty(flag.tags) && flag.tags.contains(tags)) && !GFlagsUtil.GFLAGS_FORBIDDEN_TO_OVERRIDE.contains(flag.name)) diff --git a/managed/src/main/resources/swagger-strict.json b/managed/src/main/resources/swagger-strict.json index c47f5fdd6a9c..ee450ab6d19f 100644 --- a/managed/src/main/resources/swagger-strict.json +++ b/managed/src/main/resources/swagger-strict.json @@ -30776,6 +30776,12 @@ "name" : "mostUsedGFlags", "required" : false, "type" : "boolean" + }, { + "default" : false, + "in" : "query", + "name" : "showExperimental", + "required" : false, + "type" : "boolean" } ], "responses" : { "200" : { diff --git a/managed/src/main/resources/swagger.json b/managed/src/main/resources/swagger.json index deca6eddf323..d9304fa994b6 100644 --- a/managed/src/main/resources/swagger.json +++ b/managed/src/main/resources/swagger.json @@ -32629,6 +32629,12 @@ "name" : "mostUsedGFlags", "required" : false, "type" : "boolean" + }, { + "default" : false, + "in" : "query", + "name" : "showExperimental", + "required" : false, + "type" : "boolean" } ], "responses" : { "200" : { diff --git a/managed/src/main/resources/v1.routes b/managed/src/main/resources/v1.routes index 3d355d621b91..36ad0a9861e5 100644 --- a/managed/src/main/resources/v1.routes +++ b/managed/src/main/resources/v1.routes @@ -561,7 +561,7 @@ GET /customers/:cUUID/universes/:uniUUID/support_bundle/:sbUUID/download c DELETE /customers/:cUUID/universes/:uniUUID/support_bundle/:sbUUID com.yugabyte.yw.controllers.SupportBundleController.delete(cUUID: java.util.UUID, uniUUID: java.util.UUID, sbUUID: java.util.UUID, request: Request) # GFlags Validation API -GET /metadata/version/:version/list_gflags com.yugabyte.yw.controllers.GFlagsValidationUiOnlyController.listGFlags(version: String, name: String ?= "", server: String ?= "", mostUsedGFlags: java.lang.Boolean ?= false) +GET /metadata/version/:version/list_gflags com.yugabyte.yw.controllers.GFlagsValidationUiOnlyController.listGFlags(version: String, name: String ?= "", server: String ?= "", mostUsedGFlags: java.lang.Boolean ?= false, showExperimental: java.lang.Boolean ?= false) POST /metadata/version/:version/validate_gflags com.yugabyte.yw.controllers.GFlagsValidationUiOnlyController.validateGFlags(version: String, request: Request) GET /metadata/version/:version/gflag com.yugabyte.yw.controllers.GFlagsValidationUiOnlyController.getGFlagMetadata(version: String, name: String ?= "", server: String ?= "")