meter

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgeGauge

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

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

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

func (*AgeGauge) MeterId

func (g *AgeGauge) MeterId() *Id

MeterId returns the meter identifier.

func (*AgeGauge) Now

func (g *AgeGauge) Now()

Now records the current time in epoch seconds, using a spectatord feature.

func (*AgeGauge) Set

func (g *AgeGauge) Set(seconds int64)

Set records the current time in seconds since the epoch.

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 adds an int64 delta to the current measurement.

func (*Counter) AddFloat

func (c *Counter) AddFloat(delta float64)

AddFloat adds a 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 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) 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

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.

This version of the monotonic counter is intended to support use cases where a data source value needs to be transformed into base units through division (e.g. nanoseconds into seconds), and thus, the data type is float64.

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

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

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

func (*MonotonicCounter) MeterId

func (c *MonotonicCounter) MeterId() *Id

MeterId returns the meter identifier.

func (*MonotonicCounter) Set

func (c *MonotonicCounter) Set(value float64)

Set sets a value as the current measurement; spectatord calculates the delta.

type MonotonicCounterUint added in v2.0.3

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

MonotonicCounterUint 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.

This version of the monotonic counter is intended to support use cases where a data source value can be sampled as-is, because it is already in base units, such as bytes, and thus, the data type is uint64.

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 NewMonotonicCounterUint added in v2.0.3

func NewMonotonicCounterUint(id *Id, writer writer.Writer) *MonotonicCounterUint

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

func (*MonotonicCounterUint) MeterId added in v2.0.3

func (c *MonotonicCounterUint) MeterId() *Id

MeterId returns the meter identifier.

func (*MonotonicCounterUint) Set added in v2.0.3

func (c *MonotonicCounterUint) Set(value uint64)

Set sets a value as the current measurement; spectatord calculates the delta.

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 an amount 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