meter

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgeGauge added in v1.1.0

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

AgeGauge represents a value that is the time in seconds since the epoch at which an event has successfully occurred, or 0 to use the current time in epoch seconds. After an Age Gauge has been set, it will continue reporting the number of seconds since the last time recorded, for as long as the spectatord process runs. The purpose of this metric type is to enable users to more easily implement the Time Since Last Success alerting pattern.

To set `now()` as the last success, set a value of 0.

func NewAgeGauge added in v1.1.0

func NewAgeGauge(id *Id, writer writer.Writer) *AgeGauge

NewAgeGauge generates a new gauge, using the provided meter identifier.

func (*AgeGauge) MeterId added in v1.1.0

func (g *AgeGauge) MeterId() *Id

MeterId returns the meter identifier.

func (*AgeGauge) Now added in v1.1.0

func (g *AgeGauge) Now()

Now records the current time in epoch seconds in spectatord.

func (*AgeGauge) Set added in v1.1.0

func (g *AgeGauge) Set(value int64)

Set records the current value.

type Counter

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

Counter is used to measure the rate at which some event is occurring. This type is safe for concurrent use.

You can find more about this type by viewing the relevant Java Spectator documentation here:

https://netflix.github.io/spectator/en/latest/intro/counter/

func NewCounter

func NewCounter(id *Id, writer writer.Writer) *Counter

NewCounter generates a new counter, using the provided meter identifier.

func (*Counter) Add

func (c *Counter) Add(delta int64)

Add is to add a specific int64 delta to the current measurement.

func (*Counter) AddFloat

func (c *Counter) AddFloat(delta float64)

AddFloat adds a specific float64 delta to the current measurement.

func (*Counter) Increment

func (c *Counter) Increment()

Increment increments the counter.

func (*Counter) MeterId

func (c *Counter) MeterId() *Id

MeterId returns the meter identifier.

type DistributionSummary

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

DistributionSummary is used to track the distribution of events. This is safe for concurrent use.

You can find more about this type by viewing the relevant Java Spectator documentation here:

https://netflix.github.io/spectator/en/latest/intro/dist-summary/

func NewDistributionSummary

func NewDistributionSummary(id *Id, writer writer.Writer) *DistributionSummary

NewDistributionSummary generates a new distribution summary, using the provided meter identifier.

func (*DistributionSummary) MeterId

func (d *DistributionSummary) MeterId() *Id

MeterId returns the meter identifier.

func (*DistributionSummary) Record

func (d *DistributionSummary) Record(amount int64)

Record records a new value to track within the distribution.

type Gauge

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

Gauge represents a value that is sampled at a specific point in time. One example might be the pending messages in a queue. This type is safe for concurrent use.

You can find more about this type by viewing the relevant Java Spectator documentation here:

https://netflix.github.io/spectator/en/latest/intro/gauge/

func NewGauge

func NewGauge(id *Id, writer writer.Writer) *Gauge

NewGauge generates a new gauge, using the provided meter identifier.

func NewGaugeWithTTL

func NewGaugeWithTTL(id *Id, writer writer.Writer, ttl time.Duration) *Gauge

NewGaugeWithTTL generates a new gauge, using the provided meter identifier and ttl.

func (*Gauge) MeterId

func (g *Gauge) MeterId() *Id

MeterId returns the meter identifier.

func (*Gauge) Set

func (g *Gauge) Set(value float64)

Set records the current value.

type Id

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

Id represents a meter's identifying information and dimensions (tags).

func NewId

func NewId(name string, tags map[string]string) *Id

NewId generates a new *Id from the metric name, and the tags you want to include on your metric.

func (*Id) MapKey

func (id *Id) MapKey() string

MapKey computes and saves a key within the struct to be used to uniquely identify this *Id in a map. This does use the information from within the *Id, so it assumes you've not accidentally double-declared this *Id.

func (*Id) Name

func (id *Id) Name() string

Name exposes the internal metric name field.

func (*Id) String

func (id *Id) String() string

func (*Id) Tags

func (id *Id) Tags() map[string]string

Tags directly exposes the internal tags map. This is not a copy of the map, so any modifications to it will be observed by the *Id.

func (*Id) WithDefaultStat

func (id *Id) WithDefaultStat(stat string) *Id

WithDefaultStat is effectively the WithStat() method, except it only creates the deep copy if the "statistic" tag is not set or is set to empty string. If the "statistic" tag is already present, the *Id is returned without being copied.

func (*Id) WithStat

func (id *Id) WithStat(stat string) *Id

WithStat is id.WithTag("statistic", stat). See that method's documentation for more info.

func (*Id) WithTag

func (id *Id) WithTag(key string, value string) *Id

WithTag creates a deep copy of the *Id, adding the requested tag to the internal collection.

func (*Id) WithTags

func (id *Id) WithTags(tags map[string]string) *Id

WithTags takes a map of tags, and returns a deep copy of *Id with the new tags appended to the original ones. Overlapping keys are overwritten. If the input to this method is empty, this does not return a deep copy of *Id.

type MaxGauge

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

MaxGauge represents a value that is sampled at a specific point in time. One example might be the pending messages in a queue. This type is safe for concurrent use.

You can find more about this type by viewing the relevant Java Spectator documentation here:

https://netflix.github.io/spectator/en/latest/intro/gauge/

func NewMaxGauge

func NewMaxGauge(id *Id, writer writer.Writer) *MaxGauge

NewMaxGauge generates a new gauge, using the provided meter identifier.

func (*MaxGauge) MeterId

func (g *MaxGauge) MeterId() *Id

MeterId returns the meter identifier.

func (*MaxGauge) Set

func (g *MaxGauge) Set(value float64)

Set records the current value.

type MonotonicCounter added in v1.1.0

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

MonotonicCounter is used to measure the rate at which some event is occurring. This type is safe for concurrent use.

The value is a monotonically increasing number. A minimum of two samples must be received in order for spectatord to calculate a delta value and report it to the backend.

A variety of networking metrics may be reported monotonically and this metric type provides a convenient means of recording these values, at the expense of a slower time-to-first metric.

func NewMonotonicCounter added in v1.1.0

func NewMonotonicCounter(id *Id, writer writer.Writer) *MonotonicCounter

NewMonotonicCounter generates a new counter, using the provided meter identifier.

func (*MonotonicCounter) MeterId added in v1.1.0

func (c *MonotonicCounter) MeterId() *Id

MeterId returns the meter identifier.

func (*MonotonicCounter) Set added in v1.1.0

func (c *MonotonicCounter) Set(delta int64)

Set is to set a specific int64 delta as the current measurement.

type PercentileDistributionSummary

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

PercentileDistributionSummary is a distribution summary used to track the distribution of events, while also presenting the results as percentiles.

func NewPercentileDistributionSummary

func NewPercentileDistributionSummary(id *Id, writer writer.Writer) *PercentileDistributionSummary

NewPercentileDistributionSummary creates a new *PercentileDistributionSummary using the meter identifier.

func (*PercentileDistributionSummary) MeterId

func (p *PercentileDistributionSummary) MeterId() *Id

func (*PercentileDistributionSummary) Record

func (p *PercentileDistributionSummary) Record(amount int64)

Record records a new value to track within the distribution.

type PercentileTimer

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

PercentileTimer represents timing events, while capturing the histogram (percentiles) of those values.

func NewPercentileTimer

func NewPercentileTimer(
	id *Id,
	writer writer.Writer,
) *PercentileTimer

func (*PercentileTimer) MeterId

func (t *PercentileTimer) MeterId() *Id

func (*PercentileTimer) Record

func (t *PercentileTimer) Record(amount time.Duration)

Record records the value for a single event.

type Timer

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

Timer is used to measure how long (in seconds) some event is taking. This type is safe for concurrent use.

func NewTimer

func NewTimer(id *Id, writer writer.Writer) *Timer

NewTimer generates a new timer, using the provided meter identifier.

func (*Timer) MeterId

func (t *Timer) MeterId() *Id

MeterId returns the meter identifier.

func (*Timer) Record

func (t *Timer) Record(amount time.Duration)

Record records the duration this specific event took.

Jump to

Keyboard shortcuts

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