| package config_parser |
| |
| import ( |
| "config" |
| ) |
| |
| func ExpandDefaults(configs []ProjectConfigData) { |
| for _, c := range configs { |
| if !c.IsDeletedCustomer { |
| expandDefaultsForConfig(&c) |
| } |
| } |
| } |
| |
| func expandDefaultsForConfig(c *ProjectConfigData) { |
| for _, metric := range c.ProjectConfigFile.MetricDefinitions { |
| for _, report := range metric.Reports { |
| expandDefaultsForReport(report) |
| } |
| } |
| } |
| |
| var DefaultSystemProfileSelectionPolicy = map[config.ReportDefinition_ReportType]config.SystemProfileSelectionPolicy{ |
| config.ReportDefinition_FLEETWIDE_OCCURRENCE_COUNTS: config.SystemProfileSelectionPolicy_REPORT_ALL, |
| config.ReportDefinition_FLEETWIDE_HISTOGRAMS: config.SystemProfileSelectionPolicy_REPORT_ALL, |
| config.ReportDefinition_FLEETWIDE_MEANS: config.SystemProfileSelectionPolicy_REPORT_ALL, |
| config.ReportDefinition_UNIQUE_DEVICE_NUMERIC_STATS: config.SystemProfileSelectionPolicy_REPORT_ALL, |
| config.ReportDefinition_HOURLY_VALUE_NUMERIC_STATS: config.SystemProfileSelectionPolicy_REPORT_ALL, |
| config.ReportDefinition_STRING_COUNTS: config.SystemProfileSelectionPolicy_REPORT_ALL, |
| } |
| |
| func expandDefaultsForReport(report *config.ReportDefinition) { |
| if report.LocalAggregationProcedure == config.ReportDefinition_SELECT_FIRST && report.EventVectorBufferMax == 0 { |
| report.EventVectorBufferMax = 1 |
| } |
| |
| if report.SystemProfileSelection == config.SystemProfileSelectionPolicy_SELECT_DEFAULT { |
| if def, ok := DefaultSystemProfileSelectionPolicy[report.ReportType]; ok { |
| report.SystemProfileSelection = def |
| } |
| } |
| } |