Skip to content

Commit

Permalink
drop retention data from readonly settings
Browse files Browse the repository at this point in the history
  • Loading branch information
idoqo committed Jan 30, 2025
1 parent fc0cd43 commit c88f399
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 333 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 7 additions & 12 deletions api/server/v1/json/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@
"type": "object",
"properties": {
"settings": {
"description": "Settings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.",
"description": "ReadOnlySettings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.",
"type": "object",
"properties": {
"updates_enabled": {
Expand Down Expand Up @@ -717,20 +717,15 @@
"type": "boolean",
"x-order": 4
},
"platform_email": {
"description": "Percona Platform user's email, if this PMM instance is linked to the Platform.",
"type": "string",
"x-order": 5
},
"alerting_enabled": {
"description": "True if Alerting is enabled.",
"type": "boolean",
"x-order": 6
"x-order": 5
},
"pmm_public_address": {
"description": "PMM Server public address.",
"type": "string",
"x-order": 7
"x-order": 6
},
"advisor_run_intervals": {
"description": "AdvisorRunIntervals represents intervals between each run of Advisor checks.",
Expand All @@ -752,22 +747,22 @@
"x-order": 2
}
},
"x-order": 8
"x-order": 7
},
"backup_management_enabled": {
"description": "True if Backup Management is enabled.",
"type": "boolean",
"x-order": 9
"x-order": 8
},
"azurediscover_enabled": {
"description": "True if Azure Discover is enabled.",
"type": "boolean",
"x-order": 10
"x-order": 9
},
"enable_access_control": {
"description": "True if Access Control is enabled.",
"type": "boolean",
"x-order": 11
"x-order": 10
}
},
"x-order": 0
Expand Down
522 changes: 255 additions & 267 deletions api/server/v1/server.pb.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions api/server/v1/server.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions api/server/v1/server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ message Settings {
uint32 default_role_id = 18;
}

// Settings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.
// ReadOnlySettings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.
message ReadOnlySettings {
// True if updates are enabled.
bool updates_enabled = 1;
Expand All @@ -190,21 +190,19 @@ message ReadOnlySettings {
MetricsResolutions metrics_resolutions = 3;
google.protobuf.Duration data_retention = 4;
// True if Advisor is enabled.
bool advisor_enabled = 7;
// Percona Platform user's email, if this PMM instance is linked to the Platform.
string platform_email = 8;
bool advisor_enabled = 5;
// True if Alerting is enabled.
bool alerting_enabled = 10;
bool alerting_enabled = 6;
// PMM Server public address.
string pmm_public_address = 11;
string pmm_public_address = 7;
// Intervals between Advisor runs.
AdvisorRunIntervals advisor_run_intervals = 12;
AdvisorRunIntervals advisor_run_intervals = 8;
// True if Backup Management is enabled.
bool backup_management_enabled = 13;
bool backup_management_enabled = 9;
// True if Azure Discover is enabled.
bool azurediscover_enabled = 14;
bool azurediscover_enabled = 10;
// True if Access Control is enabled.
bool enable_access_control = 17;
bool enable_access_control = 11;
}

message GetSettingsRequest {}
Expand Down
19 changes: 7 additions & 12 deletions api/swagger/swagger-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -27502,7 +27502,7 @@
"type": "object",
"properties": {
"settings": {
"description": "Settings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.",
"description": "ReadOnlySettings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.",
"type": "object",
"properties": {
"updates_enabled": {
Expand Down Expand Up @@ -27546,20 +27546,15 @@
"type": "boolean",
"x-order": 4
},
"platform_email": {
"description": "Percona Platform user's email, if this PMM instance is linked to the Platform.",
"type": "string",
"x-order": 5
},
"alerting_enabled": {
"description": "True if Alerting is enabled.",
"type": "boolean",
"x-order": 6
"x-order": 5
},
"pmm_public_address": {
"description": "PMM Server public address.",
"type": "string",
"x-order": 7
"x-order": 6
},
"advisor_run_intervals": {
"description": "AdvisorRunIntervals represents intervals between each run of Advisor checks.",
Expand All @@ -27581,22 +27576,22 @@
"x-order": 2
}
},
"x-order": 8
"x-order": 7
},
"backup_management_enabled": {
"description": "True if Backup Management is enabled.",
"type": "boolean",
"x-order": 9
"x-order": 8
},
"azurediscover_enabled": {
"description": "True if Azure Discover is enabled.",
"type": "boolean",
"x-order": 10
"x-order": 9
},
"enable_access_control": {
"description": "True if Access Control is enabled.",
"type": "boolean",
"x-order": 11
"x-order": 10
}
},
"x-order": 0
Expand Down
19 changes: 7 additions & 12 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -26544,7 +26544,7 @@
"type": "object",
"properties": {
"settings": {
"description": "Settings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.",
"description": "ReadOnlySettings represents a stripped-down version of PMM Server settings that can be accessed by users of all roles.",
"type": "object",
"properties": {
"updates_enabled": {
Expand Down Expand Up @@ -26588,20 +26588,15 @@
"type": "boolean",
"x-order": 4
},
"platform_email": {
"description": "Percona Platform user's email, if this PMM instance is linked to the Platform.",
"type": "string",
"x-order": 5
},
"alerting_enabled": {
"description": "True if Alerting is enabled.",
"type": "boolean",
"x-order": 6
"x-order": 5
},
"pmm_public_address": {
"description": "PMM Server public address.",
"type": "string",
"x-order": 7
"x-order": 6
},
"advisor_run_intervals": {
"description": "AdvisorRunIntervals represents intervals between each run of Advisor checks.",
Expand All @@ -26623,22 +26618,22 @@
"x-order": 2
}
},
"x-order": 8
"x-order": 7
},
"backup_management_enabled": {
"description": "True if Backup Management is enabled.",
"type": "boolean",
"x-order": 9
"x-order": 8
},
"azurediscover_enabled": {
"description": "True if Azure Discover is enabled.",
"type": "boolean",
"x-order": 10
"x-order": 9
},
"enable_access_control": {
"description": "True if Access Control is enabled.",
"type": "boolean",
"x-order": 11
"x-order": 10
}
},
"x-order": 0
Expand Down
17 changes: 3 additions & 14 deletions managed/services/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,22 +494,11 @@ func (s *Server) convertSettings(settings *models.Settings, connectedToPlatform
return res
}

// convertReadOnlySettings merges database settings and settings from environment variables into API response.
// convertReadOnlySettings creates a subset of database settings for non-admin roles.
func (s *Server) convertReadOnlySettings(settings *models.Settings) *serverv1.ReadOnlySettings {
res := &serverv1.ReadOnlySettings{
UpdatesEnabled: settings.IsUpdatesEnabled(),
TelemetryEnabled: settings.IsTelemetryEnabled(),
MetricsResolutions: &serverv1.MetricsResolutions{
Hr: durationpb.New(settings.MetricsResolutions.HR),
Mr: durationpb.New(settings.MetricsResolutions.MR),
Lr: durationpb.New(settings.MetricsResolutions.LR),
},
AdvisorRunIntervals: &serverv1.AdvisorRunIntervals{
RareInterval: durationpb.New(settings.SaaS.AdvisorRunIntervals.RareInterval),
StandardInterval: durationpb.New(settings.SaaS.AdvisorRunIntervals.StandardInterval),
FrequentInterval: durationpb.New(settings.SaaS.AdvisorRunIntervals.FrequentInterval),
},
DataRetention: durationpb.New(settings.DataRetention),
UpdatesEnabled: settings.IsUpdatesEnabled(),
TelemetryEnabled: settings.IsTelemetryEnabled(),
AdvisorEnabled: settings.IsAdvisorsEnabled(),
AzurediscoverEnabled: settings.IsAzureDiscoverEnabled(),
PmmPublicAddress: settings.PMMPublicAddress,
Expand Down

0 comments on commit c88f399

Please sign in to comment.