parse config for metrics fields
This commit is contained in:
parent
87a814397d
commit
5c10a9325e
|
@ -60,6 +60,8 @@ client {
|
|||
gc_inode_usage_threshold = 91
|
||||
gc_max_allocs = 50
|
||||
no_host_uuid = false
|
||||
disable_tagged_metrics = true
|
||||
backwards_compatible_metrics = true
|
||||
}
|
||||
server {
|
||||
enabled = true
|
||||
|
|
|
@ -229,6 +229,14 @@ type ClientConfig struct {
|
|||
// NoHostUUID disables using the host's UUID and will force generation of a
|
||||
// random UUID.
|
||||
NoHostUUID *bool `mapstructure:"no_host_uuid"`
|
||||
|
||||
// DisableTaggedMetrics disables a new version of generating metrics and
|
||||
// uses only the old method of displaying metrics
|
||||
DisableTaggedMetrics bool `mapstructure:"disable_tagged_metrics"`
|
||||
|
||||
// BackwardsCompatibleMetrics allows for generating metrics as done in older
|
||||
// versions of Nomad
|
||||
BackwardsCompatibleMetrics bool `mapstructure:"backwards_compatible_metrics"`
|
||||
}
|
||||
|
||||
// ACLConfig is configuration specific to the ACL system
|
||||
|
@ -576,17 +584,19 @@ func DefaultConfig() *Config {
|
|||
Consul: config.DefaultConsulConfig(),
|
||||
Vault: config.DefaultVaultConfig(),
|
||||
Client: &ClientConfig{
|
||||
Enabled: false,
|
||||
MaxKillTimeout: "30s",
|
||||
ClientMinPort: 14000,
|
||||
ClientMaxPort: 14512,
|
||||
Reserved: &Resources{},
|
||||
GCInterval: 1 * time.Minute,
|
||||
GCParallelDestroys: 2,
|
||||
GCDiskUsageThreshold: 80,
|
||||
GCInodeUsageThreshold: 70,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: helper.BoolToPtr(true),
|
||||
Enabled: false,
|
||||
MaxKillTimeout: "30s",
|
||||
ClientMinPort: 14000,
|
||||
ClientMaxPort: 14512,
|
||||
Reserved: &Resources{},
|
||||
GCInterval: 1 * time.Minute,
|
||||
GCParallelDestroys: 2,
|
||||
GCDiskUsageThreshold: 80,
|
||||
GCInodeUsageThreshold: 70,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: helper.BoolToPtr(true),
|
||||
DisableTaggedMetrics: false,
|
||||
BackwardsCompatibleMetrics: false,
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: false,
|
||||
|
@ -1097,6 +1107,14 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
|
|||
result.NoHostUUID = b.NoHostUUID
|
||||
}
|
||||
|
||||
if b.DisableTaggedMetrics {
|
||||
result.DisableTaggedMetrics = b.DisableTaggedMetrics
|
||||
}
|
||||
|
||||
if b.BackwardsCompatibleMetrics {
|
||||
result.BackwardsCompatibleMetrics = b.BackwardsCompatibleMetrics
|
||||
}
|
||||
|
||||
// Add the servers
|
||||
result.Servers = append(result.Servers, b.Servers...)
|
||||
|
||||
|
|
|
@ -357,6 +357,8 @@ func parseClient(result **ClientConfig, list *ast.ObjectList) error {
|
|||
"gc_parallel_destroys",
|
||||
"gc_max_allocs",
|
||||
"no_host_uuid",
|
||||
"disable_tagged_metrics",
|
||||
"backwards_compatible_metrics",
|
||||
}
|
||||
if err := checkHCLKeys(listVal, valid); err != nil {
|
||||
return err
|
||||
|
|
|
@ -75,12 +75,14 @@ func TestConfig_Parse(t *testing.T) {
|
|||
ReservedPorts: "1,100,10-12",
|
||||
ParsedReservedPorts: []int{1, 10, 11, 12, 100},
|
||||
},
|
||||
GCInterval: 6 * time.Second,
|
||||
GCParallelDestroys: 6,
|
||||
GCDiskUsageThreshold: 82,
|
||||
GCInodeUsageThreshold: 91,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: helper.BoolToPtr(false),
|
||||
GCInterval: 6 * time.Second,
|
||||
GCParallelDestroys: 6,
|
||||
GCDiskUsageThreshold: 82,
|
||||
GCInodeUsageThreshold: 91,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: helper.BoolToPtr(false),
|
||||
DisableTaggedMetrics: true,
|
||||
BackwardsCompatibleMetrics: true,
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: true,
|
||||
|
|
Loading…
Reference in a new issue