-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2829 from influxdb/reenable_graphite
Re-enable Graphite support
- Loading branch information
Showing
9 changed files
with
532 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,74 @@ | ||
package graphite | ||
|
||
import "strings" | ||
import ( | ||
"strings" | ||
|
||
"github.com/influxdb/influxdb/cluster" | ||
"github.com/influxdb/influxdb/toml" | ||
) | ||
|
||
const ( | ||
// DefaultBindAddress is the default binding interface if none is specified. | ||
DefaultBindAddress = ":2003" | ||
|
||
// DefaultDatabase is the default database if none is specified. | ||
DefaultDatabase = "graphite" | ||
|
||
// DefaultNameSeparator represents the default field separator. | ||
DefaultNameSeparator = "." | ||
|
||
// DefaultNamePosition represents the default location of the name. | ||
DefaultNamePosition = "last" | ||
|
||
// DefaultProtocol is the default IP protocol used by the Graphite input. | ||
DefaultProtocol = "tcp" | ||
|
||
// DefaultConsistencyLevel is the default write consistency for the Graphite input. | ||
DefaultConsistencyLevel = "one" | ||
) | ||
|
||
// Config represents the configuration for Graphite endpoints. | ||
type Config struct { | ||
BindAddress string `toml:"bind-address"` | ||
Database string `toml:"database"` | ||
Enabled bool `toml:"enabled"` | ||
Protocol string `toml:"protocol"` | ||
NamePosition string `toml:"name-position"` | ||
NameSeparator string `toml:"name-separator"` | ||
BindAddress string `toml:"bind-address"` | ||
Database string `toml:"database"` | ||
Enabled bool `toml:"enabled"` | ||
Protocol string `toml:"protocol"` | ||
NamePosition string `toml:"name-position"` | ||
NameSeparator string `toml:"name-separator"` | ||
BatchSize int `toml:"batch-size"` | ||
BatchTimeout toml.Duration `toml:"batch-timeout"` | ||
ConsistencyLevel string `toml:"consistency-level"` | ||
} | ||
|
||
// NewConfig returns a new Config with defaults. | ||
func NewConfig() Config { | ||
return Config{ | ||
Database: DefaultDatabase, | ||
NameSeparator: DefaultNameSeparator, | ||
BindAddress: DefaultBindAddress, | ||
Database: DefaultDatabase, | ||
Protocol: DefaultProtocol, | ||
NamePosition: DefaultNamePosition, | ||
NameSeparator: DefaultNameSeparator, | ||
ConsistencyLevel: DefaultConsistencyLevel, | ||
} | ||
} | ||
|
||
// LastEnabled returns whether the server should interpret the last field as "name". | ||
func (c *Config) LastEnabled() bool { | ||
return c.NamePosition == strings.ToLower("last") | ||
} | ||
|
||
// ConsistencyAsEnum returns the enumerated write consistency level. | ||
func (c *Config) ConsistencyAsEnum() cluster.ConsistencyLevel { | ||
switch strings.ToLower(c.ConsistencyLevel) { | ||
case "any": | ||
return cluster.ConsistencyLevelAny | ||
case "one": | ||
return cluster.ConsistencyLevelOne | ||
case "quorum": | ||
return cluster.ConsistencyLevelQuorum | ||
case "all": | ||
return cluster.ConsistencyLevelAll | ||
default: | ||
return cluster.ConsistencyLevelOne | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.