histogram

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package histogram provides types and functionality for capturing metrics, and presenting them as percentiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PercentileBucketsBucket

func PercentileBucketsBucket(v int64) int64

PercentileBucketsBucket returns the bucketValue for the specific value.

func PercentileBucketsIndex

func PercentileBucketsIndex(v int64) int

PercentileBucketsIndex calculates which bucket handles that specific value.

func PercentileBucketsLength

func PercentileBucketsLength() int

PercentileBucketsLength returns the lengths of the package local bucketValues variable, to give an idea of how many buckets exist.

func PercentileBucketsPercentile

func PercentileBucketsPercentile(counts []int64, pct float64) float64

PercentileBucketsPercentile takes the counts, and returns the requested percentile value based on the counts.

func PercentileBucketsPercentiles

func PercentileBucketsPercentiles(counts []int64, pcts []float64) []float64

PercentileBucketsPercentiles takes the counts, and desired percentiles, and generates the proper results.

func PercentileTimerBuilder

func PercentileTimerBuilder() *percTimerBuilder

PercentileTimerBuilder returns a builder of the *PercentileTimer, which has some default values. You do this by calling the Build method on the returned value.

Types

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(registry *spectator.Registry, name string, tags map[string]string) *PercentileDistributionSummary

NewPercentileDistributionSummary creates a new *PercentileDistributionSummary using the registry to create the meter identifier.

func NewPercentileDistributionSummaryWithId

func NewPercentileDistributionSummaryWithId(registry *spectator.Registry, id *spectator.Id) *PercentileDistributionSummary

NewPercentileDistributionSummaryWithId creates a new *PercentileDistributionSummary using the meter identifier.

func (*PercentileDistributionSummary) Count

Count returns the number of unique events that have been tracked.

func (*PercentileDistributionSummary) Percentile

Percentile returns the distribution for a specific percentile.

func (*PercentileDistributionSummary) Record

func (t *PercentileDistributionSummary) Record(amount int64)

Record records a new value to track within the distribution.

func (*PercentileDistributionSummary) TotalAmount

func (t *PercentileDistributionSummary) TotalAmount() int64

TotalAmount is the total of all records summed together.

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(registry *spectator.Registry, name string, tags map[string]string) *PercentileTimer

NewPercentileTimer creates a new *PercentileTimer using the registry to create the meter identifier.

func NewPercentileTimerWithId

func NewPercentileTimerWithId(registry *spectator.Registry, id *spectator.Id) *PercentileTimer

NewPercentileTimerWithId creates a new *PercentileTimer using the meter identifier.

func NewPercentileTimerWithIdRange

func NewPercentileTimerWithIdRange(registry *spectator.Registry, id *spectator.Id,
	minDuration time.Duration, maxDuration time.Duration) *PercentileTimer

NewPercentileTimerWithIdRange creates a new *PercentileTimer, while specifying the minimum / maximum range.

func (*PercentileTimer) Count

func (t *PercentileTimer) Count() int64

Count returns the count of timed events.

func (*PercentileTimer) Percentile

func (t *PercentileTimer) Percentile(p float64) float64

Percentile returns the latency for a specific percentile.

func (*PercentileTimer) Record

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

Record records the value for a single event.

func (*PercentileTimer) TotalTime

func (t *PercentileTimer) TotalTime() time.Duration

TotalTime returns the total duration.

Jump to

Keyboard shortcuts

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