From 00249e94618a11c533e68010949d078001168e45 Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Thu, 26 Mar 2020 17:37:26 +0100 Subject: [PATCH] Saner and consistent YAML fields in config (#2273) * Saner YAML fields in config Signed-off-by: Goutham Veeramachaneni * Address feedback Signed-off-by: Goutham Veeramachaneni --- aws/dynamodb_storage_client.go | 22 +++++++++++----------- aws/metrics_autoscaling.go | 18 +++++++++--------- gcp/bigtable_index_client.go | 4 ++-- storage/factory.go | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/aws/dynamodb_storage_client.go b/aws/dynamodb_storage_client.go index fa2b6679fdc9..47a5354b1802 100644 --- a/aws/dynamodb_storage_client.go +++ b/aws/dynamodb_storage_client.go @@ -99,13 +99,13 @@ func init() { // DynamoDBConfig specifies config for a DynamoDB database. type DynamoDBConfig struct { - DynamoDB flagext.URLValue - APILimit float64 - ThrottleLimit float64 - ApplicationAutoScaling flagext.URLValue - Metrics MetricsAutoScalingConfig - ChunkGangSize int - ChunkGetMaxParallelism int + DynamoDB flagext.URLValue `yaml:"dynamodb_url"` + APILimit float64 `yaml:"api_limit"` + ThrottleLimit float64 `yaml:"throttle_limit"` + ApplicationAutoScaling flagext.URLValue `yaml:"application_autoscaling_url"` + Metrics MetricsAutoScalingConfig `yaml:"metrics"` + ChunkGangSize int `yaml:"chunk_gang_size"` + ChunkGetMaxParallelism int `yaml:"chunk_get_max_parallelism"` backoffConfig util.BackoffConfig } @@ -116,8 +116,8 @@ func (cfg *DynamoDBConfig) RegisterFlags(f *flag.FlagSet) { f.Float64Var(&cfg.APILimit, "dynamodb.api-limit", 2.0, "DynamoDB table management requests per second limit.") f.Float64Var(&cfg.ThrottleLimit, "dynamodb.throttle-limit", 10.0, "DynamoDB rate cap to back off when throttled.") f.Var(&cfg.ApplicationAutoScaling, "applicationautoscaling.url", "ApplicationAutoscaling endpoint URL with escaped Key and Secret encoded.") - f.IntVar(&cfg.ChunkGangSize, "dynamodb.chunk.gang.size", 10, "Number of chunks to group together to parallelise fetches (zero to disable)") - f.IntVar(&cfg.ChunkGetMaxParallelism, "dynamodb.chunk.get.max.parallelism", 32, "Max number of chunk-get operations to start in parallel") + f.IntVar(&cfg.ChunkGangSize, "dynamodb.chunk-gang-size", 10, "Number of chunks to group together to parallelise fetches (zero to disable)") + f.IntVar(&cfg.ChunkGetMaxParallelism, "dynamodb.chunk.get-max-parallelism", 32, "Max number of chunk-get operations to start in parallel") f.DurationVar(&cfg.backoffConfig.MinBackoff, "dynamodb.min-backoff", 100*time.Millisecond, "Minimum backoff time") f.DurationVar(&cfg.backoffConfig.MaxBackoff, "dynamodb.max-backoff", 50*time.Second, "Maximum backoff time") f.IntVar(&cfg.backoffConfig.MaxRetries, "dynamodb.max-retries", 20, "Maximum number of times to retry an operation") @@ -126,8 +126,8 @@ func (cfg *DynamoDBConfig) RegisterFlags(f *flag.FlagSet) { // StorageConfig specifies config for storing data on AWS. type StorageConfig struct { - DynamoDBConfig - S3Config `yaml:",inline"` + DynamoDBConfig `yaml:"dynamodb"` + S3Config `yaml:",inline"` } // RegisterFlags adds the flags required to config this to the given FlagSet diff --git a/aws/metrics_autoscaling.go b/aws/metrics_autoscaling.go index 871516fdb38f..b9958fbed5f4 100644 --- a/aws/metrics_autoscaling.go +++ b/aws/metrics_autoscaling.go @@ -41,15 +41,15 @@ const ( // MetricsAutoScalingConfig holds parameters to configure how it works type MetricsAutoScalingConfig struct { - URL string // URL to contact Prometheus store on - TargetQueueLen int64 // Queue length above which we will scale up capacity - ScaleUpFactor float64 // Scale up capacity by this multiple - MinThrottling float64 // Ignore throttling below this level - QueueLengthQuery string // Promql query to fetch ingester queue length - ThrottleQuery string // Promql query to fetch throttle rate per table - UsageQuery string // Promql query to fetch write capacity usage per table - ReadUsageQuery string // Promql query to fetch read usage per table - ReadErrorQuery string // Promql query to fetch read errors per table + URL string `yaml:"url"` // URL to contact Prometheus store on + TargetQueueLen int64 `yaml:"target_queue_length"` // Queue length above which we will scale up capacity + ScaleUpFactor float64 `yaml:"scale_up_factor"` // Scale up capacity by this multiple + MinThrottling float64 `yaml:"ignore_throttle_below"` // Ignore throttling below this level + QueueLengthQuery string `yaml:"queue_length_query"` // Promql query to fetch ingester queue length + ThrottleQuery string `yaml:"write_throttle_query"` // Promql query to fetch throttle rate per table + UsageQuery string `yaml:"write_usage_query"` // Promql query to fetch write capacity usage per table + ReadUsageQuery string `yaml:"read_usage_query"` // Promql query to fetch read usage per table + ReadErrorQuery string `yaml:"read_error_query"` // Promql query to fetch read errors per table deprecatedErrorRateQuery string } diff --git a/gcp/bigtable_index_client.go b/gcp/bigtable_index_client.go index c163e529f1c7..39a7f44c8788 100644 --- a/gcp/bigtable_index_client.go +++ b/gcp/bigtable_index_client.go @@ -40,8 +40,8 @@ type Config struct { ColumnKey bool `yaml:"-"` DistributeKeys bool `yaml:"-"` - TableCacheEnabled bool - TableCacheExpiration time.Duration + TableCacheEnabled bool `yaml:"table_cache_enabled"` + TableCacheExpiration time.Duration `yaml:"table_cache_expiration"` } // RegisterFlags adds the flags required to config this to the given FlagSet diff --git a/storage/factory.go b/storage/factory.go index dc89bf67f336..ef74d02ebf9d 100644 --- a/storage/factory.go +++ b/storage/factory.go @@ -59,7 +59,7 @@ type Config struct { BoltDBConfig local.BoltDBConfig `yaml:"boltdb"` FSConfig local.FSConfig `yaml:"filesystem"` - IndexCacheValidity time.Duration + IndexCacheValidity time.Duration `yaml:"index_cache_validity"` IndexQueriesCacheConfig cache.Config `yaml:"index_queries_cache_config"`