Documentation ¶
Index ¶
- Constants
- Variables
- func NewTemplate(pattern string, defaultTags models.Tags, separator string) (*template, error)
- type Config
- type Options
- type Parser
- type Service
- func (s *Service) Addr() net.Addr
- func (s *Service) Close() error
- func (s *Service) Closed() bool
- func (s *Service) Diagnostics() (*diagnostics.Diagnostics, error)
- func (s *Service) Open() error
- func (s *Service) SetLogOutput(w io.Writer)
- func (s *Service) Statistics(tags map[string]string) []models.Statistic
- type Statistics
- type UnsupportedValueError
Constants ¶
const ( // DefaultBindAddress is the default binding interface if none is specified. DefaultBindAddress = ":2003" // DefaultDatabase is the default database if none is specified. DefaultDatabase = "graphite" // 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" // DefaultSeparator is the default join character to use when joining multiple // measurement parts in a template. DefaultSeparator = "." // DefaultBatchSize is the default write batch size. DefaultBatchSize = 5000 // DefaultBatchPending is the default number of pending write batches. DefaultBatchPending = 10 // DefaultBatchTimeout is the default Graphite batch timeout. DefaultBatchTimeout = time.Second // DefaultUDPReadBuffer is the default buffer size for the UDP listener. // Sets the size of the operating system's receive buffer associated with // the UDP traffic. Keep in mind that the OS must be able // to handle the number set here or the UDP listener will error and exit. // // DefaultReadBuffer = 0 means to use the OS default, which is usually too // small for high UDP performance. // // Increasing OS buffer limits: // Linux: sudo sysctl -w net.core.rmem_max=<read-buffer> // BSD/Darwin: sudo sysctl -w kern.ipc.maxsockbuf=<read-buffer> DefaultUDPReadBuffer = 0 )
Variables ¶
var ( MinDate = time.Date(1901, 12, 13, 0, 0, 0, 0, time.UTC) MaxDate = time.Date(2038, 1, 19, 0, 0, 0, 0, time.UTC) )
Minimum and maximum supported dates for timestamps.
Functions ¶
Types ¶
type Config ¶
type Config struct { Enabled bool `toml:"enabled"` BindAddress string `toml:"bind-address"` Database string `toml:"database"` RetentionPolicy string `toml:"retention-policy"` Protocol string `toml:"protocol"` BatchSize int `toml:"batch-size"` BatchPending int `toml:"batch-pending"` BatchTimeout toml.Duration `toml:"batch-timeout"` ConsistencyLevel string `toml:"consistency-level"` Templates []string `toml:"templates"` Tags []string `toml:"tags"` Separator string `toml:"separator"` UDPReadBuffer int `toml:"udp-read-buffer"` }
Config represents the configuration for Graphite endpoints.
func (*Config) DefaultTags ¶
DefaultTags returns the config's tags.
func (*Config) WithDefaults ¶
WithDefaults takes the given config and returns a new config with any required default values set.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser encapsulates a Graphite Parser.
func NewParserWithOptions ¶
NewParserWithOptions returns a graphite parser using the given options
func (*Parser) ApplyTemplate ¶ added in v0.9.5
ApplyTemplate extracts the template fields from the given line and returns the measurement name and tags.
type Service ¶
type Service struct { Monitor interface { RegisterDiagnosticsClient(name string, client diagnostics.Client) DeregisterDiagnosticsClient(name string) } PointsWriter interface { WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, points []models.Point) error } MetaClient interface { CreateDatabase(name string) (*meta.DatabaseInfo, error) CreateDatabaseWithRetentionPolicy(name string, spec *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error) CreateRetentionPolicy(database string, spec *meta.RetentionPolicySpec) (*meta.RetentionPolicyInfo, error) Database(name string) *meta.DatabaseInfo RetentionPolicy(database, name string) (*meta.RetentionPolicyInfo, error) } // contains filtered or unexported fields }
Service represents a Graphite service.
func NewService ¶
NewService returns an instance of the Graphite service.
func (*Service) Diagnostics ¶ added in v0.9.5
func (s *Service) Diagnostics() (*diagnostics.Diagnostics, error)
Diagnostics returns diagnostics of the graphite service.
func (*Service) SetLogOutput ¶ added in v1.0.0
SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.
type Statistics ¶ added in v1.0.0
type Statistics struct { PointsReceived int64 BytesReceived int64 PointsParseFail int64 PointsNaNFail int64 BatchesTransmitted int64 PointsTransmitted int64 BatchesTransmitFail int64 ActiveConnections int64 HandledConnections int64 }
Statistics maintains statistics for the graphite service.
type UnsupportedValueError ¶ added in v0.12.0
An UnsupportedValueError is returned when a parsed value is not supported.
func (*UnsupportedValueError) Error ¶ added in v0.12.0
func (err *UnsupportedValueError) Error() string