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
|
||||
|
@ -587,6 +595,8 @@ func DefaultConfig() *Config {
|
|||
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
|
||||
|
|
|
@ -81,6 +81,8 @@ func TestConfig_Parse(t *testing.T) {
|
|||
GCInodeUsageThreshold: 91,
|
||||
GCMaxAllocs: 50,
|
||||
NoHostUUID: helper.BoolToPtr(false),
|
||||
DisableTaggedMetrics: true,
|
||||
BackwardsCompatibleMetrics: true,
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: true,
|
||||
|
|
Loading…
Reference in New Issue