wavefront

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric struct {
	// Name is the full metric name (e.g. some.cool.count)
	Name string

	// Value is the numerical value of the metric.
	Value float64

	// Precision is the number of decimal places to keep in sending the metric.
	// Defaults to 0
	Precision int

	// Timestamp is the Unix epoch seconds at which the metric was measured.
	// If omitted, will take the time at point at which the metric was received
	// by the Wavefront proxy
	Timestamp int64
}

Metric is a representation of a single metric

func NewMetric

func NewMetric(name string, value float64) *Metric

NewMetric returns a metric with the given name and value. The timestamp will default to the current time and the Precision to 0 The value of the Metric can be updated with Update()

func (*Metric) Update

func (m *Metric) Update(value float64) *Metric

Update updates the value of a metric

type PointTag

type PointTag struct {
	// Key is the name of the point tag
	Key string

	// Value is the value of the point tag
	Value string
}

PointTag represents a metric point-tag, which is simply a key/value pair

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is used to write metrics to a Wavefront proxy. It will maintain an open connection until Close() is explicitly called. All metrics will be sent with the source and point-tags associated with the Writer.

func NewWriter

func NewWriter(address string, port int, source string, tags []*PointTag) (*Writer, error)

NewWriter returns a Writer object configured to send metrics to the address and port given. The Source of the Writer will be set to 'source' PointTags will be configured, pass nil if none required The Writer should be closed with Close() when no longer required

func (*Writer) Close

func (w *Writer) Close()

Close is used to close the connection to the Wavefront proxy

func (*Writer) SetPointTags

func (w *Writer) SetPointTags(tags []*PointTag)

SetPointTags sets or updates the point tags with which metrics will be sent from this Writer

func (*Writer) SetSource

func (w *Writer) SetSource(source string)

SetSource sets or updates the source with which metrics will be sent from this Writer

func (*Writer) Write

func (w *Writer) Write(m *Metric) error

Write writes a metric to a Wavefront proxy

Jump to

Keyboard shortcuts

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