Skip to content

Commit

Permalink
Merge pull request #1816 from jippi/add-datadog-telemetry
Browse files Browse the repository at this point in the history
Add datadog telemetry
  • Loading branch information
dadgar authored Oct 18, 2016
2 parents f0806dc + bc8858e commit 746eeb1
Show file tree
Hide file tree
Showing 9 changed files with 812 additions and 5 deletions.
10 changes: 10 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/armon/go-metrics"
"github.com/armon/go-metrics/circonus"
"github.com/armon/go-metrics/datadog"
"github.com/hashicorp/consul/lib"
"github.com/hashicorp/go-checkpoint"
"github.com/hashicorp/go-syslog"
Expand Down Expand Up @@ -617,6 +618,15 @@ func (c *Command) setupTelemetry(config *Config) error {
fanout = append(fanout, sink)
}

// Configure the datadog sink
if telConfig.DataDogAddr != "" {
sink, err := datadog.NewDogStatsdSink(telConfig.DataDogAddr, config.NodeName)
if err != nil {
return err
}
fanout = append(fanout, sink)
}

// Configure the Circonus sink
if telConfig.CirconusAPIToken != "" || telConfig.CirconusCheckSubmissionURL != "" {
cfg := &circonus.Config{}
Expand Down
4 changes: 4 additions & 0 deletions command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func (s *ServerConfig) EncryptBytes() ([]byte, error) {
type Telemetry struct {
StatsiteAddr string `mapstructure:"statsite_address"`
StatsdAddr string `mapstructure:"statsd_address"`
DataDogAddr string `mapstructure:"datadog_address"`
DisableHostname bool `mapstructure:"disable_hostname"`
CollectionInterval string `mapstructure:"collection_interval"`
collectionInterval time.Duration `mapstructure:"-"`
Expand Down Expand Up @@ -773,6 +774,9 @@ func (a *Telemetry) Merge(b *Telemetry) *Telemetry {
if b.StatsdAddr != "" {
result.StatsdAddr = b.StatsdAddr
}
if b.DataDogAddr != "" {
result.DataDogAddr = b.DataDogAddr
}
if b.DisableHostname {
result.DisableHostname = true
}
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 @@ -36,6 +36,7 @@ func TestConfig_Merge(t *testing.T) {
Telemetry: &Telemetry{
StatsiteAddr: "127.0.0.1:8125",
StatsdAddr: "127.0.0.1:8125",
DataDogAddr: "127.0.0.1:8125",
DisableHostname: false,
CirconusAPIToken: "0",
CirconusAPIApp: "nomadic",
Expand Down Expand Up @@ -148,6 +149,7 @@ func TestConfig_Merge(t *testing.T) {
Telemetry: &Telemetry{
StatsiteAddr: "127.0.0.2:8125",
StatsdAddr: "127.0.0.2:8125",
DataDogAddr: "127.0.0.1:8125",
DisableHostname: true,
PublishNodeMetrics: true,
PublishAllocationMetrics: true,
Expand Down
19 changes: 19 additions & 0 deletions vendor/github.com/DataDog/datadog-go/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions vendor/github.com/DataDog/datadog-go/statsd/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 746eeb1

Please sign in to comment.