Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes all the occurences of omitempty #2209

Merged
merged 2 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [ENHANCEMENT] Experimental TSDB: Add support for local `filesystem` backend. #2245
* [ENHANCEMENT] Allow 1w (where w denotes week) and 1y (where y denotes year) when setting table period and retention. #2252
* [ENHANCEMENT] Added FIFO cache metrics for current number of entries and memory usage. #2270
* [ENHANCEMENT] Output all config fields to /config API, including those with empty value. #2209
* [BUGFIX] Fixed etcd client keepalive settings. #2278
* [BUGFIX] Fixed bug in updating last element of FIFO cache. #2270

Expand Down Expand Up @@ -405,4 +406,4 @@ This release has several exciting features, the most notable of them being setti
* `ha-tracker.cluster` is now `distributor.ha-tracker.cluster`
* [FEATURE] You can specify "heap ballast" to reduce Go GC Churn #1489
* [BUGFIX] HA Tracker no longer always makes a request to Consul/Etcd when a request is not from the active replica #1516
* [BUGFIX] Queries are now correctly cancelled by the query-frontend #1508
* [BUGFIX] Queries are now correctly cancelled by the query-frontend #1508
4 changes: 2 additions & 2 deletions pkg/chunk/cache/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var (

// BackgroundConfig is config for a Background Cache.
type BackgroundConfig struct {
WriteBackGoroutines int `yaml:"writeback_goroutines,omitempty"`
WriteBackBuffer int `yaml:"writeback_buffer,omitempty"`
WriteBackGoroutines int `yaml:"writeback_goroutines"`
WriteBackBuffer int `yaml:"writeback_buffer"`
}

// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
Expand Down
16 changes: 8 additions & 8 deletions pkg/chunk/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ type Cache interface {

// Config for building Caches.
type Config struct {
EnableFifoCache bool `yaml:"enable_fifocache,omitempty"`
EnableFifoCache bool `yaml:"enable_fifocache"`

DefaultValidity time.Duration `yaml:"default_validity,omitempty"`
DefaultValidity time.Duration `yaml:"default_validity"`

Background BackgroundConfig `yaml:"background,omitempty"`
Memcache MemcachedConfig `yaml:"memcached,omitempty"`
MemcacheClient MemcachedClientConfig `yaml:"memcached_client,omitempty"`
Redis RedisConfig `yaml:"redis,omitempty"`
Fifocache FifoCacheConfig `yaml:"fifocache,omitempty"`
Background BackgroundConfig `yaml:"background"`
Memcache MemcachedConfig `yaml:"memcached"`
MemcacheClient MemcachedClientConfig `yaml:"memcached_client"`
Redis RedisConfig `yaml:"redis"`
Fifocache FifoCacheConfig `yaml:"fifocache"`

// This is to name the cache metrics properly.
Prefix string `yaml:"prefix,omitempty" doc:"hidden"`
Prefix string `yaml:"prefix" doc:"hidden"`

// For tests to inject specific implementations.
Cache Cache `yaml:"-"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/chunk/cache/fifo_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ var (

// FifoCacheConfig holds config for the FifoCache.
type FifoCacheConfig struct {
Size int `yaml:"size,omitempty"`
Validity time.Duration `yaml:"validity,omitempty"`
Size int `yaml:"size"`
Validity time.Duration `yaml:"validity"`
}

// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
Expand Down
6 changes: 3 additions & 3 deletions pkg/chunk/cache/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func (o observableVecCollector) After(method, statusCode string, start time.Time

// MemcachedConfig is config to make a Memcached
type MemcachedConfig struct {
Expiration time.Duration `yaml:"expiration,omitempty"`
Expiration time.Duration `yaml:"expiration"`

BatchSize int `yaml:"batch_size,omitempty"`
Parallelism int `yaml:"parallelism,omitempty"`
BatchSize int `yaml:"batch_size"`
Parallelism int `yaml:"parallelism"`
}

// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
Expand Down
12 changes: 6 additions & 6 deletions pkg/chunk/cache/memcached_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ type memcachedClient struct {

// MemcachedClientConfig defines how a MemcachedClient should be constructed.
type MemcachedClientConfig struct {
Host string `yaml:"host,omitempty"`
Service string `yaml:"service,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
MaxIdleConns int `yaml:"max_idle_conns,omitempty"`
UpdateInterval time.Duration `yaml:"update_interval,omitempty"`
ConsistentHash bool `yaml:"consistent_hash,omitempty"`
Host string `yaml:"host"`
Service string `yaml:"service"`
Timeout time.Duration `yaml:"timeout"`
MaxIdleConns int `yaml:"max_idle_conns"`
UpdateInterval time.Duration `yaml:"update_interval"`
ConsistentHash bool `yaml:"consistent_hash"`
}

// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
Expand Down
10 changes: 5 additions & 5 deletions pkg/chunk/cache/redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ type RedisCache struct {

// RedisConfig defines how a RedisCache should be constructed.
type RedisConfig struct {
Endpoint string `yaml:"endpoint,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
Expiration time.Duration `yaml:"expiration,omitempty"`
MaxIdleConns int `yaml:"max_idle_conns,omitempty"`
MaxActiveConns int `yaml:"max_active_conns,omitempty"`
Endpoint string `yaml:"endpoint"`
Timeout time.Duration `yaml:"timeout"`
Expiration time.Duration `yaml:"expiration"`
MaxIdleConns int `yaml:"max_idle_conns"`
MaxActiveConns int `yaml:"max_active_conns"`
Password flagext.Secret `yaml:"password"`
EnableTLS bool `yaml:"enable_tls"`
}
Expand Down
30 changes: 15 additions & 15 deletions pkg/chunk/cassandra/storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ import (

// Config for a StorageClient
type Config struct {
Addresses string `yaml:"addresses,omitempty"`
Port int `yaml:"port,omitempty"`
Keyspace string `yaml:"keyspace,omitempty"`
Consistency string `yaml:"consistency,omitempty"`
ReplicationFactor int `yaml:"replication_factor,omitempty"`
DisableInitialHostLookup bool `yaml:"disable_initial_host_lookup,omitempty"`
SSL bool `yaml:"SSL,omitempty"`
HostVerification bool `yaml:"host_verification,omitempty"`
CAPath string `yaml:"CA_path,omitempty"`
Auth bool `yaml:"auth,omitempty"`
Username string `yaml:"username,omitempty"`
Password flagext.Secret `yaml:"password,omitempty"`
PasswordFile string `yaml:"password_file,omitempty"`
Addresses string `yaml:"addresses"`
Port int `yaml:"port"`
Keyspace string `yaml:"keyspace"`
Consistency string `yaml:"consistency"`
ReplicationFactor int `yaml:"replication_factor"`
DisableInitialHostLookup bool `yaml:"disable_initial_host_lookup"`
SSL bool `yaml:"SSL"`
HostVerification bool `yaml:"host_verification"`
CAPath string `yaml:"CA_path"`
Auth bool `yaml:"auth"`
Username string `yaml:"username"`
Password flagext.Secret `yaml:"password"`
PasswordFile string `yaml:"password_file"`
CustomAuthenticators flagext.StringSlice `yaml:"custom_authenticators"`
Timeout time.Duration `yaml:"timeout,omitempty"`
ConnectTimeout time.Duration `yaml:"connect_timeout,omitempty"`
Timeout time.Duration `yaml:"timeout"`
ConnectTimeout time.Duration `yaml:"connect_timeout"`
Retries int `yaml:"max_retries"`
MaxBackoff time.Duration `yaml:"retry_max_backoff"`
MinBackoff time.Duration `yaml:"retry_min_backoff"`
Expand Down
6 changes: 3 additions & 3 deletions pkg/chunk/chunk_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ var (

// StoreConfig specifies config for a ChunkStore
type StoreConfig struct {
ChunkCacheConfig cache.Config `yaml:"chunk_cache_config,omitempty"`
WriteDedupeCacheConfig cache.Config `yaml:"write_dedupe_cache_config,omitempty"`
ChunkCacheConfig cache.Config `yaml:"chunk_cache_config"`
WriteDedupeCacheConfig cache.Config `yaml:"write_dedupe_cache_config"`

CacheLookupsOlderThan time.Duration `yaml:"cache_lookups_older_than,omitempty"`
CacheLookupsOlderThan time.Duration `yaml:"cache_lookups_older_than"`

// Limits query start time to be greater than now() - MaxLookBackPeriod, if set.
MaxLookBackPeriod time.Duration `yaml:"max_look_back_period"`
Expand Down
16 changes: 8 additions & 8 deletions pkg/chunk/schema_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type PeriodConfig struct {
ObjectType string `yaml:"object_store"` // type of object client to use; if omitted, defaults to store.
Schema string `yaml:"schema"`
IndexTables PeriodicTableConfig `yaml:"index"`
ChunkTables PeriodicTableConfig `yaml:"chunks,omitempty"`
ChunkTables PeriodicTableConfig `yaml:"chunks"`
RowShards uint32 `yaml:"row_shards"`
}

Expand Down Expand Up @@ -330,13 +330,13 @@ func (cfg PeriodicTableConfig) MarshalYAML() (interface{}, error) {

// AutoScalingConfig for DynamoDB tables.
type AutoScalingConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
RoleARN string `yaml:"role_arn,omitempty"`
MinCapacity int64 `yaml:"min_capacity,omitempty"`
MaxCapacity int64 `yaml:"max_capacity,omitempty"`
OutCooldown int64 `yaml:"out_cooldown,omitempty"`
InCooldown int64 `yaml:"in_cooldown,omitempty"`
TargetValue float64 `yaml:"target,omitempty"`
Enabled bool `yaml:"enabled"`
RoleARN string `yaml:"role_arn"`
MinCapacity int64 `yaml:"min_capacity"`
MaxCapacity int64 `yaml:"max_capacity"`
OutCooldown int64 `yaml:"out_cooldown"`
InCooldown int64 `yaml:"in_cooldown"`
TargetValue float64 `yaml:"target"`
}

// RegisterFlags adds the flags required to config this to the given FlagSet.
Expand Down
4 changes: 2 additions & 2 deletions pkg/chunk/storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ type Config struct {

IndexCacheValidity time.Duration

IndexQueriesCacheConfig cache.Config `yaml:"index_queries_cache_config,omitempty"`
IndexQueriesCacheConfig cache.Config `yaml:"index_queries_cache_config"`

DeleteStoreConfig purger.DeleteStoreConfig `yaml:"delete_store,omitempty"`
DeleteStoreConfig purger.DeleteStoreConfig `yaml:"delete_store"`
}

// RegisterFlags adds the flags required to configure this flag set.
Expand Down
6 changes: 3 additions & 3 deletions pkg/compactor/compactor_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
// is used to strip down the config to the minimum, and avoid confusion
// to the user.
type RingConfig struct {
KVStore kv.Config `yaml:"kvstore,omitempty"`
HeartbeatPeriod time.Duration `yaml:"heartbeat_period,omitempty"`
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout,omitempty"`
KVStore kv.Config `yaml:"kvstore"`
HeartbeatPeriod time.Duration `yaml:"heartbeat_period"`
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"`

// Instance details
InstanceID string `yaml:"instance_id" doc:"hidden"`
Expand Down
46 changes: 23 additions & 23 deletions pkg/cortex/cortex.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,35 @@ import (

// Config is the root config for Cortex.
type Config struct {
Target moduleName `yaml:"target,omitempty"`
AuthEnabled bool `yaml:"auth_enabled,omitempty"`
Target moduleName `yaml:"target"`
AuthEnabled bool `yaml:"auth_enabled"`
PrintConfig bool `yaml:"-"`
HTTPPrefix string `yaml:"http_prefix"`

Server server.Config `yaml:"server,omitempty"`
Distributor distributor.Config `yaml:"distributor,omitempty"`
Querier querier.Config `yaml:"querier,omitempty"`
IngesterClient client.Config `yaml:"ingester_client,omitempty"`
Ingester ingester.Config `yaml:"ingester,omitempty"`
Flusher flusher.Config `yaml:"flusher,omitempty"`
Storage storage.Config `yaml:"storage,omitempty"`
ChunkStore chunk.StoreConfig `yaml:"chunk_store,omitempty"`
Schema chunk.SchemaConfig `yaml:"schema,omitempty" doc:"hidden"` // Doc generation tool doesn't support it because part of the SchemaConfig doesn't support CLI flags (needs manual documentation)
LimitsConfig validation.Limits `yaml:"limits,omitempty"`
Prealloc client.PreallocConfig `yaml:"prealloc,omitempty" doc:"hidden"`
Worker frontend.WorkerConfig `yaml:"frontend_worker,omitempty"`
Frontend frontend.Config `yaml:"frontend,omitempty"`
QueryRange queryrange.Config `yaml:"query_range,omitempty"`
TableManager chunk.TableManagerConfig `yaml:"table_manager,omitempty"`
Server server.Config `yaml:"server"`
Distributor distributor.Config `yaml:"distributor"`
Querier querier.Config `yaml:"querier"`
IngesterClient client.Config `yaml:"ingester_client"`
Ingester ingester.Config `yaml:"ingester"`
Flusher flusher.Config `yaml:"flusher"`
Storage storage.Config `yaml:"storage"`
ChunkStore chunk.StoreConfig `yaml:"chunk_store"`
Schema chunk.SchemaConfig `yaml:"schema" doc:"hidden"` // Doc generation tool doesn't support it because part of the SchemaConfig doesn't support CLI flags (needs manual documentation)
LimitsConfig validation.Limits `yaml:"limits"`
Prealloc client.PreallocConfig `yaml:"prealloc" doc:"hidden"`
Worker frontend.WorkerConfig `yaml:"frontend_worker"`
Frontend frontend.Config `yaml:"frontend"`
QueryRange queryrange.Config `yaml:"query_range"`
TableManager chunk.TableManagerConfig `yaml:"table_manager"`
Encoding encoding.Config `yaml:"-"` // No yaml for this, it only works with flags.
TSDB tsdb.Config `yaml:"tsdb"`
Compactor compactor.Config `yaml:"compactor,omitempty"`
DataPurgerConfig purger.Config `yaml:"purger,omitempty"`
Compactor compactor.Config `yaml:"compactor"`
DataPurgerConfig purger.Config `yaml:"purger"`

Ruler ruler.Config `yaml:"ruler,omitempty"`
Configs configs.Config `yaml:"configs,omitempty"`
Alertmanager alertmanager.MultitenantAlertmanagerConfig `yaml:"alertmanager,omitempty"`
RuntimeConfig runtimeconfig.ManagerConfig `yaml:"runtime_config,omitempty"`
Ruler ruler.Config `yaml:"ruler"`
Configs configs.Config `yaml:"configs"`
Alertmanager alertmanager.MultitenantAlertmanagerConfig `yaml:"alertmanager"`
RuntimeConfig runtimeconfig.ManagerConfig `yaml:"runtime_config"`
MemberlistKV memberlist.KVConfig `yaml:"memberlist"`
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ type Distributor struct {
// Config contains the configuration require to
// create a Distributor
type Config struct {
PoolConfig ingester_client.PoolConfig `yaml:"pool,omitempty"`
PoolConfig ingester_client.PoolConfig `yaml:"pool"`

HATrackerConfig HATrackerConfig `yaml:"ha_tracker,omitempty"`
HATrackerConfig HATrackerConfig `yaml:"ha_tracker"`

MaxRecvMsgSize int `yaml:"max_recv_msg_size"`
RemoteTimeout time.Duration `yaml:"remote_timeout,omitempty"`
ExtraQueryDelay time.Duration `yaml:"extra_queue_delay,omitempty"`
RemoteTimeout time.Duration `yaml:"remote_timeout"`
ExtraQueryDelay time.Duration `yaml:"extra_queue_delay"`

ShardByAllLabels bool `yaml:"shard_by_all_labels,omitempty"`
ShardByAllLabels bool `yaml:"shard_by_all_labels"`

// Distributors ring
DistributorRing RingConfig `yaml:"ring,omitempty"`
DistributorRing RingConfig `yaml:"ring"`

// for testing
ingesterClientFactory client.Factory `yaml:"-"`
Expand Down
6 changes: 3 additions & 3 deletions pkg/distributor/distributor_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
// is used to strip down the config to the minimum, and avoid confusion
// to the user.
type RingConfig struct {
KVStore kv.Config `yaml:"kvstore,omitempty"`
HeartbeatPeriod time.Duration `yaml:"heartbeat_period,omitempty"`
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout,omitempty"`
KVStore kv.Config `yaml:"kvstore"`
HeartbeatPeriod time.Duration `yaml:"heartbeat_period"`
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"`

// Instance details
InstanceID string `yaml:"instance_id" doc:"hidden"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/distributor/ha_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type haTracker struct {
// HATrackerConfig contains the configuration require to
// create a HA Tracker.
type HATrackerConfig struct {
EnableHATracker bool `yaml:"enable_ha_tracker,omitempty"`
EnableHATracker bool `yaml:"enable_ha_tracker"`
// We should only update the timestamp if the difference
// between the stored timestamp and the time we received a sample at
// is more than this duration.
Expand Down
6 changes: 3 additions & 3 deletions pkg/flusher/flusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (

// Config for an Ingester.
type Config struct {
WALDir string `yaml:"wal_dir,omitempty"`
ConcurrentFlushes int `yaml:"concurrent_flushes,omitempty"`
FlushOpTimeout time.Duration `yaml:"flush_op_timeout,omitempty"`
WALDir string `yaml:"wal_dir"`
ConcurrentFlushes int `yaml:"concurrent_flushes"`
FlushOpTimeout time.Duration `yaml:"flush_op_timeout"`
}

// RegisterFlags adds the flags required to config this to the given FlagSet
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/client/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ type Factory func(addr string) (grpc_health_v1.HealthClient, error)

// PoolConfig is config for creating a Pool.
type PoolConfig struct {
ClientCleanupPeriod time.Duration `yaml:"client_cleanup_period,omitempty"`
HealthCheckIngesters bool `yaml:"health_check_ingesters,omitempty"`
ClientCleanupPeriod time.Duration `yaml:"client_cleanup_period"`
HealthCheckIngesters bool `yaml:"health_check_ingesters"`
RemoteTimeout time.Duration `yaml:"-"`
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ var (

// Config for an Ingester.
type Config struct {
WALConfig WALConfig `yaml:"walconfig,omitempty"`
LifecyclerConfig ring.LifecyclerConfig `yaml:"lifecycler,omitempty"`
WALConfig WALConfig `yaml:"walconfig"`
LifecyclerConfig ring.LifecyclerConfig `yaml:"lifecycler"`

// Config for transferring chunks. Zero or negative = no retries.
MaxTransferRetries int `yaml:"max_transfer_retries,omitempty"`
MaxTransferRetries int `yaml:"max_transfer_retries"`

// Config for chunk flushing.
FlushCheckPeriod time.Duration
Expand Down
10 changes: 5 additions & 5 deletions pkg/ingester/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (

// WALConfig is config for the Write Ahead Log.
type WALConfig struct {
WALEnabled bool `yaml:"wal_enabled,omitempty"`
CheckpointEnabled bool `yaml:"checkpoint_enabled,omitempty"`
Recover bool `yaml:"recover_from_wal,omitempty"`
Dir string `yaml:"wal_dir,omitempty"`
CheckpointDuration time.Duration `yaml:"checkpoint_duration,omitempty"`
WALEnabled bool `yaml:"wal_enabled"`
CheckpointEnabled bool `yaml:"checkpoint_enabled"`
Recover bool `yaml:"recover_from_wal"`
Dir string `yaml:"wal_dir"`
CheckpointDuration time.Duration `yaml:"checkpoint_duration"`
metricsRegisterer prometheus.Registerer `yaml:"-"`
}

Expand Down
Loading