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

Add tags option to datadog telemetry #3839

Merged
merged 1 commit into from
Feb 6, 2018
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
1 change: 1 addition & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ func (c *Command) setupTelemetry(config *Config) (*metrics.InmemSink, error) {
if err != nil {
return inm, err
}
sink.SetTags(telConfig.DataDogTags)
fanout = append(fanout, sink)
}

Expand Down
4 changes: 4 additions & 0 deletions command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ type Telemetry struct {
StatsiteAddr string `mapstructure:"statsite_address"`
StatsdAddr string `mapstructure:"statsd_address"`
DataDogAddr string `mapstructure:"datadog_address"`
DataDogTags []string `mapstructure:"datadog_tags"`
PrometheusMetrics bool `mapstructure:"prometheus_metrics"`
DisableHostname bool `mapstructure:"disable_hostname"`
UseNodeName bool `mapstructure:"use_node_name"`
Expand Down Expand Up @@ -1170,6 +1171,9 @@ func (a *Telemetry) Merge(b *Telemetry) *Telemetry {
if b.DataDogAddr != "" {
result.DataDogAddr = b.DataDogAddr
}
if b.DataDogTags != nil {
result.DataDogTags = b.DataDogTags
}
if b.PrometheusMetrics {
result.PrometheusMetrics = b.PrometheusMetrics
}
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 @@ -641,6 +641,7 @@ func parseTelemetry(result **Telemetry, list *ast.ObjectList) error {
"publish_allocation_metrics",
"publish_node_metrics",
"datadog_address",
"datadog_tags",
"prometheus_metrics",
"circonus_api_token",
"circonus_api_app",
Expand Down
2 changes: 2 additions & 0 deletions command/agent/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestConfig_Merge(t *testing.T) {
StatsiteAddr: "127.0.0.1:8125",
StatsdAddr: "127.0.0.1:8125",
DataDogAddr: "127.0.0.1:8125",
DataDogTags: []string{"cat1:tag1", "cat2:tag2"},
PrometheusMetrics: true,
DisableHostname: false,
DisableTaggedMetrics: true,
Expand Down Expand Up @@ -191,6 +192,7 @@ func TestConfig_Merge(t *testing.T) {
StatsiteAddr: "127.0.0.2:8125",
StatsdAddr: "127.0.0.2:8125",
DataDogAddr: "127.0.0.1:8125",
DataDogTags: []string{"cat1:tag1", "cat2:tag2"},
PrometheusMetrics: true,
DisableHostname: true,
PublishNodeMetrics: true,
Expand Down
1 change: 1 addition & 0 deletions website/source/api/agent.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ $ curl \
"CirconusSubmissionInterval": "",
"CollectionInterval": "1s",
"DataDogAddr": "",
"DataDogTags": [],
"DisableHostname": false,
"PublishAllocationMetrics": false,
"PublishNodeMetrics": false,
Expand Down
6 changes: 6 additions & 0 deletions website/source/docs/agent/configuration/telemetry.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ These `telemetry` parameters apply to
- `datadog_address` `(string: "")` - Specifies the address of a DataDog statsd
server to forward metrics to.

- `datadog_tags` `(list: [])` - Specifies a list of global tags that will be
added to all telemetry packets sent to DogStatsD. It is a list of strings,
where each string looks like "my_tag_name:my_tag_value".


```hcl
telemetry {
datadog_address = "dogstatsd.company.local:8125"
datadog_tags = ["my_tag_name:my_tag_value"]
}
```

Expand Down