Skip to content

Commit

Permalink
Update protos and return TAtomicSharedPtr in metric extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Gazizonoki committed Dec 3, 2024
1 parent cdb5b8c commit e72e17c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class TMetricRegistryConnector: public NYdb::IExtension {
return p.get();
}

static NMonitoring::IMetricRegistry* ToRawPtr(TAtomicSharedPtr<NMonitoring::IMetricRegistry> p) {
return p.Get();
}

public:
using IApi = NYdb::NSdkStats::IStatApi;
Expand Down Expand Up @@ -57,4 +60,12 @@ inline void AddMetricRegistry(NYdb::TDriver& driver, std::shared_ptr<NMonitoring
driver.AddExtension<TConnector>(TConnector::TParams(ptr));
}

inline void AddMetricRegistry(NYdb::TDriver& driver, TAtomicSharedPtr<NMonitoring::IMetricRegistry> ptr) {
if (!ptr)
return;
using TConnector = TMetricRegistryConnector<TAtomicSharedPtr<NMonitoring::IMetricRegistry>>;

driver.AddExtension<TConnector>(TConnector::TParams(ptr));
}

} // namespace NSolomonStatExtension
7 changes: 7 additions & 0 deletions src/api/protos/draft/fq.proto
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ message MySQLCluster {
IamAuth auth = 5;
}

message Logging {
string folder_id = 1;
IamAuth auth = 2;
}

message ConnectionSetting {
enum ConnectionType {
CONNECTION_TYPE_UNSPECIFIED = 0;
Expand All @@ -526,6 +531,7 @@ message ConnectionSetting {
POSTGRESQL_CLUSTER = 6;
GREENPLUM_CLUSTER = 7;
MYSQL_CLUSTER = 8;
LOGGING = 9;
}

oneof connection {
Expand All @@ -537,6 +543,7 @@ message ConnectionSetting {
PostgreSQLCluster postgresql_cluster = 6;
GreenplumCluster greenplum_cluster = 7;
MySQLCluster mysql_cluster = 8;
Logging logging = 9;
}
}

Expand Down
37 changes: 21 additions & 16 deletions src/api/protos/ydb_cms.proto
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,28 @@ message DatabaseQuotas {
repeated StorageQuotas storage_quotas = 6;
}

// A policy that is used for resource scale recommendation. If multiple are used,
// recommender combines them to recommend the largest scale.
message ScaleRecommenderPolicy {
// Policy that tracks metric and reactively recommend to adjust resources scale
// to keep metric close to the specified target value.
message TargetTrackingPolicy {
oneof target {
// A percentage of compute resources' average CPU utilization.
uint32 average_cpu_utilization_percent = 1;
message ScaleRecommenderPolicies {
// A policy that is used for resource scale recommendation. If multiple are used,
// recommender combines them to recommend the largest scale.
message ScaleRecommenderPolicy {
// Policy that tracks metric and reactively recommend to adjust resources scale
// to keep metric close to the specified target value.
message TargetTrackingPolicy {
oneof target {
// A percentage of compute resources' average CPU utilization.
uint32 average_cpu_utilization_percent = 1;
}
}
}

oneof policy {
TargetTrackingPolicy target_tracking_policy = 1;
oneof policy {
TargetTrackingPolicy target_tracking_policy = 1;
}
}

repeated ScaleRecommenderPolicy policies = 1;
}


// Request to create a new database. For successfull creation
// specified database shouldn't exist. At least one storage
// unit should be requested for the database.
Expand All @@ -149,7 +154,7 @@ message CreateDatabaseRequest {
// Optional quotas for the database
DatabaseQuotas database_quotas = 10;
// Optional scale recommender policies
repeated ScaleRecommenderPolicy scale_recommender_policies = 11;
ScaleRecommenderPolicies scale_recommender_policies = 11;
}

message CreateDatabaseResponse {
Expand Down Expand Up @@ -201,7 +206,7 @@ message GetDatabaseStatusResult {
// Current quotas for the database
DatabaseQuotas database_quotas = 10;
// Current scale recommender policies
repeated ScaleRecommenderPolicy scale_recommender_policies = 11;
ScaleRecommenderPolicies scale_recommender_policies = 11;
}

// Change resources allocated for database.
Expand Down Expand Up @@ -230,8 +235,8 @@ message AlterDatabaseRequest {
DatabaseQuotas database_quotas = 11;
// Alter attributes. Leave the value blank to drop an attribute.
map<string, string> alter_attributes = 12;
// Alter scale recommender policies.
repeated ScaleRecommenderPolicy scale_recommender_policies = 13;
// Change scale recommender policies.
ScaleRecommenderPolicies scale_recommender_policies = 13;
}

message AlterDatabaseResponse {
Expand Down
1 change: 1 addition & 0 deletions src/api/protos/ydb_table.proto
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ message ColumnFamily {
COMPRESSION_UNSPECIFIED = 0;
COMPRESSION_NONE = 1;
COMPRESSION_LZ4 = 2;
COMPRESSION_ZSTD = 3;
}

// Name of the column family, the name "default" must be used for the
Expand Down

0 comments on commit e72e17c

Please sign in to comment.