Merge pull request #2098 from jorgemarey/f-telemetry-nodename

Allow to set the nodename on telemetry
This commit is contained in:
Alex Dadgar 2017-01-04 03:33:48 +08:00 committed by GitHub
commit 23fcd807cb
5 changed files with 11 additions and 0 deletions

View File

@ -621,6 +621,10 @@ func (c *Command) setupTelemetry(config *Config) error {
metricsConf := metrics.DefaultConfig("nomad")
metricsConf.EnableHostname = !telConfig.DisableHostname
if telConfig.UseNodeName {
metricsConf.HostName = config.NodeName
metricsConf.EnableHostname = true
}
// Configure the statsite sink
var fanout metrics.FanoutSink

View File

@ -271,6 +271,7 @@ type Telemetry struct {
StatsdAddr string `mapstructure:"statsd_address"`
DataDogAddr string `mapstructure:"datadog_address"`
DisableHostname bool `mapstructure:"disable_hostname"`
UseNodeName bool `mapstructure:"use_node_name"`
CollectionInterval string `mapstructure:"collection_interval"`
collectionInterval time.Duration `mapstructure:"-"`
PublishAllocationMetrics bool `mapstructure:"publish_allocation_metrics"`

View File

@ -527,6 +527,7 @@ func parseTelemetry(result **Telemetry, list *ast.ObjectList) error {
"statsite_address",
"statsd_address",
"disable_hostname",
"use_node_name",
"collection_interval",
"publish_allocation_metrics",
"publish_node_metrics",

View File

@ -91,6 +91,7 @@ func TestConfig_Parse(t *testing.T) {
StatsiteAddr: "127.0.0.1:1234",
StatsdAddr: "127.0.0.1:2345",
DisableHostname: true,
UseNodeName: false,
CollectionInterval: "3s",
collectionInterval: 3 * time.Second,
PublishAllocationMetrics: true,

View File

@ -45,6 +45,10 @@ The following options are available on all telemetry configurations.
- `disable_hostname` `(bool: false)` - Specifies if gauge values should be
prefixed with the local hostname.
- `use_node_name` `(bool: false)` - Specifies if gauge values should be
prefixed with the name of the node, instead of the hostname. If set it will
override [disable_hostname](#disable_hostname) value.
- `publish_allocation_metrics` `(bool: false)` - Specifies if Nomad should
publish runtime metrics of allocations.