wf

package
v0.0.0-...-5561049 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Centroid

type Centroid struct {
	Value float64
	Count float64
}

func CentroidRate

func CentroidRate(curr, prev []Centroid, duration time.Duration) []Centroid

type Distribution

type Distribution struct {
	Cumulative bool

	Source    string
	Centroids []Centroid
	Timestamp time.Time
	// contains filtered or unexported fields
}

func NewCumulativeDistribution

func NewCumulativeDistribution(name string, source string, tags map[string]string, centroids []Centroid, timestamp time.Time) *Distribution

NewCumulativeDistribution encodes prometheus style distribution.

func NewFrequencyDistribution

func NewFrequencyDistribution(name string, source string, tags map[string]string, centroids []Centroid, timestamp time.Time) *Distribution

NewFrequencyDistribution encodes a WF style distribution.

func (*Distribution) AddTags

func (d *Distribution) AddTags(tags map[string]string)

func (*Distribution) Clone

func (d *Distribution) Clone() *Distribution

func (*Distribution) Equals

func (d *Distribution) Equals(b *Distribution) bool

func (*Distribution) FilterTags

func (d *Distribution) FilterTags(pred func(string) bool)

func (*Distribution) Key

func (d *Distribution) Key() DistributionHash

func (*Distribution) Name

func (d *Distribution) Name() string

func (*Distribution) OverrideTag

func (d *Distribution) OverrideTag(name, value string)

func (*Distribution) Points

func (d *Distribution) Points() int

func (*Distribution) Rate

func (d *Distribution) Rate(prev *Distribution) *Distribution

func (*Distribution) Send

func (d *Distribution) Send(to Sender) error

func (*Distribution) SetSource

func (d *Distribution) SetSource(source string)

func (*Distribution) Tags

func (d *Distribution) Tags() map[string]string

func (*Distribution) ToFrequency

func (d *Distribution) ToFrequency() *Distribution

type DistributionHash

type DistributionHash [32]byte

type Incrementer

type Incrementer interface {
	Inc(int642 int64)
}

type LabelPair

type LabelPair struct {
	Name  *string
	Value *string
}

type Metric

type Metric interface {
	Name() string
	Tags() map[string]string
	FilterTags(pred func(string) bool)
	OverrideTag(name, value string)
	AddTags(tags map[string]string)
	SetSource(source string)
	Send(to Sender) error
	Points() int
}

func Filter

func Filter(filter filter.Filter, filtered Incrementer, point Metric) Metric

Filter returns nil when it does not match the supplied filter.Filter. Filter increments the Incrementor when filtering. Filter filters the tags on a matched point.

func FilterAppend

func FilterAppend(filter filter.Filter, filtered Incrementer, points []Metric, point Metric) []Metric

FilterAppend appends the point to points when Filter does not return nil

type Point

type Point struct {
	Metric    string
	Value     float64
	Timestamp int64
	Source    string
	// contains filtered or unexported fields
}

Point is a single point in Wavefront metric format.

func NewPoint

func NewPoint(metric string, value float64, timestamp int64, source string, tags map[string]string) *Point

func (*Point) AddTag

func (m *Point) AddTag(name, value string)

AddTag adds a tag if it does not already exist

func (*Point) AddTags

func (m *Point) AddTags(tags map[string]string)

AddTags adds any tags that do not already exist

func (*Point) FilterTags

func (m *Point) FilterTags(pred func(string) bool)

func (*Point) Name

func (m *Point) Name() string

func (*Point) OverrideTag

func (m *Point) OverrideTag(name, value string)

OverrideTag sets a tag regardless of whether it already exists

func (*Point) Points

func (m *Point) Points() int

func (*Point) Send

func (m *Point) Send(to Sender) error

func (*Point) SetLabelPairs

func (m *Point) SetLabelPairs(pairs []LabelPair)

func (*Point) SetSource

func (m *Point) SetSource(source string)

func (*Point) SetTags

func (m *Point) SetTags(tags map[string]string)

func (*Point) Tags

func (m *Point) Tags() map[string]string

type Sender

type Sender interface {
	SendMetric(name string, value float64, ts int64, source string, tags map[string]string) error
	SendDistribution(name string, centroids []histogram.Centroid, hgs map[histogram.Granularity]bool, ts int64, source string, tags map[string]string) error
}

Jump to

Keyboard shortcuts

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