aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorudovichenko-r <rvu@ydb.tech>2023-06-16 20:21:54 +0300
committerudovichenko-r <rvu@ydb.tech>2023-06-16 20:21:54 +0300
commit71d1df300ccd983492ce117bc7ccd2959fc69c57 (patch)
tree94139585b22dbdfadd924dc9e84573df5a86a813
parent45a28e0186323a370442a78ec93c318cf4004756 (diff)
downloadydb-71d1df300ccd983492ce117bc7ccd2959fc69c57.tar.gz
[yql] Increase hidden percentage for tagged features
YQL-16096
-rw-r--r--ydb/library/yql/providers/common/activation/yql_activation.cpp19
-rw-r--r--ydb/library/yql/providers/common/activation/yql_activation.h3
-rw-r--r--ydb/library/yql/providers/common/proto/gateways_config.proto15
3 files changed, 25 insertions, 12 deletions
diff --git a/ydb/library/yql/providers/common/activation/yql_activation.cpp b/ydb/library/yql/providers/common/activation/yql_activation.cpp
index b50afe3a32..3247e448fc 100644
--- a/ydb/library/yql/providers/common/activation/yql_activation.cpp
+++ b/ydb/library/yql/providers/common/activation/yql_activation.cpp
@@ -9,17 +9,16 @@
namespace NYql::NConfig {
-
template <class TActivation>
-bool Allow(const TActivation& activation, const TString& userName) {
+ui32 GetPercentage(const TActivation& activation, const TString& userName) {
if (AnyOf(activation.GetIncludeUsers(), [&](const auto& user) { return user == userName; })) {
- return true;
+ return 100;
}
if (AnyOf(activation.GetExcludeUsers(), [&](const auto& user) { return user == userName; })) {
- return false;
+ return 0;
}
- if (userName.StartsWith("robot") && activation.GetExcludeRobots()) {
- return false;
+ if ((userName.StartsWith("robot-") || userName.StartsWith("zomb-")) && activation.GetExcludeRobots()) {
+ return 0;
}
ui32 percent = activation.GetPercentage();
@@ -36,10 +35,18 @@ bool Allow(const TActivation& activation, const TString& userName) {
}
}
}
+
+ return percent;
+}
+
+template <class TActivation>
+bool Allow(const TActivation& activation, const TString& userName) {
+ ui32 percent = GetPercentage(activation, userName);
const auto random = RandomNumber<ui8>(100);
return random < percent;
}
+template ui32 GetPercentage<NYql::TActivationPercentage>(const NYql::TActivationPercentage& activation, const TString& userName);
template bool Allow<NYql::TActivationPercentage>(const NYql::TActivationPercentage& activation, const TString& userName);
} // namespace
diff --git a/ydb/library/yql/providers/common/activation/yql_activation.h b/ydb/library/yql/providers/common/activation/yql_activation.h
index 1f39c9c8ac..128a463f8b 100644
--- a/ydb/library/yql/providers/common/activation/yql_activation.h
+++ b/ydb/library/yql/providers/common/activation/yql_activation.h
@@ -5,6 +5,9 @@
namespace NYql::NConfig {
template <class TActivation>
+ui32 GetPercentage(const TActivation& activation, const TString& userName);
+
+template <class TActivation>
bool Allow(const TActivation& activation, const TString& userName);
} // namespace
diff --git a/ydb/library/yql/providers/common/proto/gateways_config.proto b/ydb/library/yql/providers/common/proto/gateways_config.proto
index 4b223fb456..24c82e2dc7 100644
--- a/ydb/library/yql/providers/common/proto/gateways_config.proto
+++ b/ydb/library/yql/providers/common/proto/gateways_config.proto
@@ -18,6 +18,7 @@ message TActivationPercentage {
repeated string IncludeUsers = 3;
repeated string ExcludeUsers = 4;
optional bool ExcludeRobots = 5 [default = true];
+ repeated string Tags = 6;
}
message TAttr {
@@ -483,10 +484,12 @@ message TDqGatewayConfig {
repeated TAttr DefaultSettings = 102;
- optional uint32 WithHiddenPercentage = 5 [default = 0];
- repeated TDefaultAutoByHourPercentage WithHiddenByHour = 6;
- repeated string NoWithHiddenForUsers = 7;
- repeated string WithHiddenForUsers = 8;
+ optional uint32 WithHiddenPercentage = 5 [default = 0]; // Depricated. TODO: remove
+ repeated TDefaultAutoByHourPercentage WithHiddenByHour = 6; // Depricated. TODO: remove
+ repeated string NoWithHiddenForUsers = 7; // Depricated. TODO: remove
+ repeated string WithHiddenForUsers = 8; // Depricated. TODO: remove
+
+ optional TActivationPercentage HiddenActivation = 9;
}
/////////////////////////////// Yql Core ///////////////////////////////
@@ -543,9 +546,9 @@ message TGenericClusterConfig {
// Location represents the network address of a data source instance we want to connect
oneof Location {
// Endpoint must be used for on-premise deployments.
- NYql.Connector.API.Endpoint Endpoint = 3;
+ NYql.Connector.API.Endpoint Endpoint = 3;
// DatabaseID must be used when the data source is deployed in cloud.
- // Data source FQDN and port will be resolved by MDB service.
+ // Data source FQDN and port will be resolved by MDB service.
string DatabaseID = 4;
}