Skip to content

Commit

Permalink
Merge pull request #4026 from influxdb/multi_graphite
Browse files Browse the repository at this point in the history
Support multiple Graphite inputs
  • Loading branch information
otoolep committed Sep 8, 2015
2 parents 6345ba8 + 332ce64 commit ca94ad8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ With this release InfluxDB is moving to Go 1.5.
- [#3886](https://github.com/influxdb/influxdb/pull/3886): Prevent write timeouts due to lock contention in WAL
- [#3574](https://github.com/influxdb/influxdb/issues/3574): Querying data node causes panic
- [#3913](https://github.com/influxdb/influxdb/issues/3913): Convert meta shard owners to objects
- [#4026](https://github.com/influxdb/influxdb/pull/4026): Support multiple Graphite inputs. Fixes issue [#3636](https://github.com/influxdb/influxdb/issues/3636)
- [#3927](https://github.com/influxdb/influxdb/issues/3927): Add WAL lock to prevent timing lock contention
- [#3928](https://github.com/influxdb/influxdb/issues/3928): Write fails for multiple points when tag starts with quote
- [#3901](https://github.com/influxdb/influxdb/pull/3901): Unblock relaxed write consistency level Thanks @takayuki!
Expand Down
1 change: 0 additions & 1 deletion cmd/influxd/run/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func NewConfig() *Config {
c.HTTPD = httpd.NewConfig()
c.Collectd = collectd.NewConfig()
c.OpenTSDB = opentsdb.NewConfig()
c.Graphites = append(c.Graphites, graphite.NewConfig())

c.ContinuousQuery = continuous_querier.NewConfig()
c.Retention = retention.NewConfig()
Expand Down
19 changes: 6 additions & 13 deletions services/graphite/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ type Config struct {
Separator string `toml:"separator"`
}

// NewConfig returns a new Config with defaults.
func NewConfig() Config {
return Config{
BindAddress: DefaultBindAddress,
Database: DefaultDatabase,
Protocol: DefaultProtocol,
BatchSize: DefaultBatchSize,
BatchTimeout: toml.Duration(DefaultBatchTimeout),
ConsistencyLevel: DefaultConsistencyLevel,
Separator: DefaultSeparator,
}
}

// WithDefaults takes the given config and returns a new config with any required
// default values set.
func (c *Config) WithDefaults() *Config {
Expand All @@ -73,6 +60,12 @@ func (c *Config) WithDefaults() *Config {
if d.Protocol == "" {
d.Protocol = DefaultProtocol
}
if d.BatchSize == 0 {
d.BatchSize = DefaultBatchSize
}
if d.BatchTimeout == 0 {
d.BatchTimeout = toml.Duration(DefaultBatchTimeout)
}
if d.ConsistencyLevel == "" {
d.ConsistencyLevel = DefaultConsistencyLevel
}
Expand Down
14 changes: 7 additions & 7 deletions services/graphite/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tags=["region=us-east"]
}

func TestConfigValidateEmptyTemplate(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Templates = []string{""}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
Expand All @@ -64,15 +64,15 @@ func TestConfigValidateEmptyTemplate(t *testing.T) {
}

func TestConfigValidateTooManyField(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Templates = []string{"a measurement b c"}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
}
}

func TestConfigValidateTemplatePatterns(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Templates = []string{"*measurement"}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
Expand All @@ -85,7 +85,7 @@ func TestConfigValidateTemplatePatterns(t *testing.T) {
}

func TestConfigValidateFilter(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Templates = []string{".server measurement*"}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
Expand All @@ -103,7 +103,7 @@ func TestConfigValidateFilter(t *testing.T) {
}

func TestConfigValidateTemplateTags(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Templates = []string{"*.server measurement* foo"}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
Expand All @@ -126,7 +126,7 @@ func TestConfigValidateTemplateTags(t *testing.T) {
}

func TestConfigValidateDefaultTags(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Tags = []string{"foo"}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
Expand All @@ -149,7 +149,7 @@ func TestConfigValidateDefaultTags(t *testing.T) {
}

func TestConfigValidateFilterDuplicates(t *testing.T) {
c := graphite.NewConfig()
c := &graphite.Config{}
c.Templates = []string{"foo measurement*", "foo .host.measurement"}
if err := c.Validate(); err == nil {
t.Errorf("config validate expected error. got nil")
Expand Down
4 changes: 2 additions & 2 deletions services/graphite/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test_ServerGraphiteTCP(t *testing.T) {

now := time.Now().UTC().Round(time.Second)

config := graphite.NewConfig()
config := graphite.Config{}
config.Database = "graphitedb"
config.BatchSize = 0 // No batching.
config.BatchTimeout = toml.Duration(time.Second)
Expand Down Expand Up @@ -87,7 +87,7 @@ func Test_ServerGraphiteUDP(t *testing.T) {

now := time.Now().UTC().Round(time.Second)

config := graphite.NewConfig()
config := graphite.Config{}
config.Database = "graphitedb"
config.BatchSize = 0 // No batching.
config.BatchTimeout = toml.Duration(time.Second)
Expand Down

0 comments on commit ca94ad8

Please sign in to comment.