client

package
v0.112.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graphite

type Graphite struct {
	Endpoint string
	Timeout  time.Duration
	Conn     io.Writer
}

Graphite is a struct that defines the relevant properties of a graphite connection. This code was initially taken from https://github.com/census-ecosystem/opencensus-go-exporter-graphite/tree/master/internal/client and modified for the needs of testing the Carbon receiver package and is not intended/tested to be used in production.

func NewGraphite

func NewGraphite(transport Transport, endpoint string) (*Graphite, error)

NewGraphite is a method that's used to create a new Graphite instance. This code was initially taken from https://github.com/census-ecosystem/opencensus-go-exporter-graphite/tree/master/internal/client and modified for the needs of testing the Carbon receiver package and is not intended/tested to be used in production.

func (*Graphite) Disconnect

func (g *Graphite) Disconnect() (err error)

Disconnect closes the Graphite.conn field

func (*Graphite) SendMetric

func (g *Graphite) SendMetric(metric Metric) error

SendMetric method can be used to just pass a metric name and value and have it be sent to the Graphite host

func (*Graphite) SendMetrics

func (g *Graphite) SendMetrics(metrics []Metric) error

SendMetrics method can be used to pass a set of metrics and have it be sent to the Graphite host

func (*Graphite) SputterThenSendMetric

func (g *Graphite) SputterThenSendMetric(metric Metric) error

SputterThenSendMetric method sends a bad partial metric, then the whole metric across.

type Metric

type Metric struct {
	Name      string
	Value     float64
	Timestamp time.Time
}

Metric contains the metric fields expected by Graphite.

func (Metric) String

func (m Metric) String() string

String formats a Metric to the format expected bt Graphite.

type Transport

type Transport int

Transport is used as an enum to select the type of transport to be used.

const (
	TCP Transport = iota
	UDP
)

Available transport options: TCP and UDP.

Jump to

Keyboard shortcuts

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