Documentation
¶
Index ¶
- Variables
- type GraphiteClient
- func NewGraphite(host string, port int) (*GraphiteClient, error)
- func NewGraphiteClient(protocol string, host string, port int, prefix string) (*GraphiteClient, error)
- func NewGraphiteNop(host string, port int) *GraphiteClient
- func NewGraphiteUDP(host string, port int) (*GraphiteClient, error)
- func NewGraphiteWithMetricPrefix(host string, port int, prefix string) (*GraphiteClient, error)
- func (gc *GraphiteClient) Connect() error
- func (gc *GraphiteClient) Disconnect() error
- func (gc *GraphiteClient) IsNop() bool
- func (gc *GraphiteClient) SendMetric(metric Metric) error
- func (gc *GraphiteClient) SendMetrics(metrics []Metric) error
- func (gc *GraphiteClient) SimpleSend(stat string, value string) bool
- func (gc *GraphiteClient) SimpleSendInt(stat string, value int) bool
- type Metric
Constants ¶
This section is empty.
Variables ¶
var ErrorGraphiteClientNotConnected = errors.New("graphite client not connected")
Functions ¶
This section is empty.
Types ¶
type GraphiteClient ¶
type GraphiteClient struct { Host string Port int Protocol string Timeout time.Duration Prefix string DisableLog bool // contains filtered or unexported fields }
GraphiteClient is a struct that defines the relevant properties of a graphite connection
func NewGraphite ¶
func NewGraphite(host string, port int) (*GraphiteClient, error)
NewGraphite is a factory method that's used to create a new GraphiteClient
func NewGraphiteClient ¶
func NewGraphiteNop ¶
func NewGraphiteNop(host string, port int) *GraphiteClient
NewGraphiteNop is a factory method that returns a GraphiteClient struct but will not actually try to send any packets to a remote host and, instead, will just log. This is useful if you want to use GraphiteClient in a project but don't want to make GraphiteClient a requirement for the project.
func NewGraphiteUDP ¶
func NewGraphiteUDP(host string, port int) (*GraphiteClient, error)
When a UDP connection to GraphiteClient is required
func NewGraphiteWithMetricPrefix ¶
func NewGraphiteWithMetricPrefix(host string, port int, prefix string) (*GraphiteClient, error)
NewGraphiteWithMetricPrefix is a factory method that's used to create a new GraphiteClient with a metric prefix
func (*GraphiteClient) Connect ¶
func (gc *GraphiteClient) Connect() error
Given a GraphiteClient struct, Connect populates the GraphiteClient.conn field with an appropriate TCP connection
func (*GraphiteClient) Disconnect ¶
func (gc *GraphiteClient) Disconnect() error
Given a GraphiteClient struct, Disconnect closes the GraphiteClient.conn field
func (*GraphiteClient) IsNop ¶
func (gc *GraphiteClient) IsNop() bool
IsNop is a getter for *graphite.GraphiteClient.nop
func (*GraphiteClient) SendMetric ¶
func (gc *GraphiteClient) SendMetric(metric Metric) error
Given a Metric struct, the SendMetric method sends the supplied metric to the GraphiteClient connection that the method is called upon
func (*GraphiteClient) SendMetrics ¶
func (gc *GraphiteClient) SendMetrics(metrics []Metric) error
Given a slice of Metrics, the SendMetrics method sends the metrics, as a batch, to the GraphiteClient connection that the method is called upon
func (*GraphiteClient) SimpleSend ¶
func (gc *GraphiteClient) SimpleSend(stat string, value string) bool
The SimpleSend method can be used to just pass a metric name and value and have it be sent to the GraphiteClient host with the current timestamp
func (*GraphiteClient) SimpleSendInt ¶
func (gc *GraphiteClient) SimpleSendInt(stat string, value int) bool