graphite

package
v0.9.0-rc32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2015 License: MIT Imports: 12 Imported by: 204

Documentation

Index

Constants

View Source
const (
	// DefaultDatabase is the default database if none is specified.
	DefaultDatabase = "graphite"

	// DefaultNameSeparator represents the default field separator.
	DefaultNameSeparator = "."
)
View Source
const (
	// DefaultGraphitePort represents the default Graphite (Carbon) plaintext port.
	DefaultGraphitePort = 2003
)

Variables

View Source
var (
	// ErrBindAddressRequired is returned when starting the Server
	// without a TCP or UDP listening address.
	ErrBindAddressRequired = errors.New("bind address required")

	// ErrServerClosed return when closing an already closed graphite server.
	ErrServerClosed = errors.New("server already closed")

	// ErrServerNotSpecified returned when Server is not specified.
	ErrServerNotSpecified = errors.New("server not present")
)

Functions

This section is empty.

Types

type Config

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"`
}

Config represents the configuration for Graphite endpoints.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with defaults.

func (*Config) LastEnabled

func (c *Config) LastEnabled() bool

LastEnabled returns whether the server should interpret the last field as "name".

type Parser

type Parser struct {
	Separator   string
	LastEnabled bool
}

Parser encapulates a Graphite Parser.

func NewParser

func NewParser() *Parser

NewParser returns a GraphiteParser instance.

func (*Parser) DecodeNameAndTags

func (p *Parser) DecodeNameAndTags(field string) (string, map[string]string, error)

DecodeNameAndTags parses the name and tags of a single field of a Graphite datum.

func (*Parser) Parse

func (p *Parser) Parse(line string) (tsdb.Point, error)

Parse performs Graphite parsing of a single line.

type SeriesWriter

type SeriesWriter interface {
	WriteSeries(string, string, []tsdb.Point) (uint64, error)
}

SeriesWriter defines the interface for the destination of the data.

type Server

type Server interface {
	SetBatchSize(sz int)
	SetBatchTimeout(t time.Duration)
	ListenAndServe(iface string) error
	Host() string
	Close() error
}

Server defines the interface all Graphite servers support.

func NewServer

func NewServer(protocol string, p *Parser, s SeriesWriter, db string) (Server, error)

NewServer return a Graphite server for the given protocol, using the given parser series writer, and database.

type Service

type Service struct{}

func NewService

func NewService(c Config) *Service

func (*Service) Addr

func (s *Service) Addr() net.Addr

func (*Service) Close

func (s *Service) Close() error

func (*Service) Open

func (s *Service) Open() error

type TCPServer

type TCPServer struct {
	Logger *log.Logger
	// contains filtered or unexported fields
}

TCPServer processes Graphite data received over TCP connections.

func NewTCPServer

func NewTCPServer(p *Parser, w SeriesWriter, db string) *TCPServer

NewTCPServer returns a new instance of a TCPServer.

func (*TCPServer) Close

func (t *TCPServer) Close() error

func (*TCPServer) Host

func (t *TCPServer) Host() string

func (*TCPServer) ListenAndServe

func (t *TCPServer) ListenAndServe(iface string) error

ListenAndServe instructs the TCPServer to start processing Graphite data on the given interface. iface must be in the form host:port

func (*TCPServer) SetBatchSize

func (t *TCPServer) SetBatchSize(sz int)

func (*TCPServer) SetBatchTimeout

func (t *TCPServer) SetBatchTimeout(d time.Duration)

type UDPServer

type UDPServer struct {
	Logger *log.Logger
	// contains filtered or unexported fields
}

UDPServer processes Graphite data received via UDP.

func NewUDPServer

func NewUDPServer(p *Parser, w SeriesWriter, db string) *UDPServer

NewUDPServer returns a new instance of a UDPServer

func (*UDPServer) Close

func (u *UDPServer) Close() error

func (*UDPServer) Host

func (u *UDPServer) Host() string

func (*UDPServer) ListenAndServe

func (u *UDPServer) ListenAndServe(iface string) error

ListenAndServer instructs the UDPServer to start processing Graphite data on the given interface. iface must be in the form host:port.

func (*UDPServer) SetBatchSize

func (u *UDPServer) SetBatchSize(sz int)

func (*UDPServer) SetBatchTimeout

func (u *UDPServer) SetBatchTimeout(d time.Duration)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL