Skip to content

Commit

Permalink
Merge pull request #2098 from jorgemarey/f-telemetry-nodename
Browse files Browse the repository at this point in the history
Allow to set the nodename on telemetry
  • Loading branch information
dadgar committed Jan 3, 2017
2 parents 0971fb6 + a39cebb commit 5031075
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions command/agent/config_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions command/agent/config_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions website/source/docs/agent/configuration/telemetry.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 5031075

Please sign in to comment.