Float attaches the methods of Observable to a float64.
(*Float) Add(other Observable)(*Float) Clear()(*Float) CopyFrom(other Observable)(*Float) Multiply(ratio float64)
String returns the float as a string.
Value returns the float's value.
*Float : Observable
*Float : expvar.Var
*Float : fmt.Stringer
*Float : context.stringer
*Float : github.com/aws/smithy-go/middleware.stringer
*Float : runtime.stringer
MinuteHourSeries tracks data at granularities of 1 minute and 1 hour.
timeSeriestimeSeries
// Clock for getting current time
// if there are pending observations
// time of last Observable tracked
// levels of bucketed Observable
// number of buckets in each level
// observations not yet bucketed
// what time are we keeping in pending
// make more Observable
// convenient aggregation of all Observable
Add records an observation at the current time.
AddWithTime records an observation at the specified time.
Clear removes all observations from the time series.
ComputeRange computes a specified number of values into a slice using
the observations recorded over the specified time period. The return
values are approximate if the start or finish times don't fall on the
bucket boundaries at the same level or if the number of buckets spanning
the range is not an integral multiple of num.
(*MinuteHourSeries) Hour() Observable
Latest returns the sum of the num latest buckets from the level.
LatestBuckets returns a copy of the num latest buckets from level.
(*MinuteHourSeries) Minute() Observable
Range returns the sum of observations added over the specified time range.
If start or finish times don't fall on bucket boundaries of the same
level, then return values are approximate answers.
Recent returns the sum of observations from the last delta.
RecentList returns the specified number of values in slice over the most
recent time period of the specified range.
ScaleBy updates observations by scaling by factor.
Total returns the total of all observations.
advance cycles the buckets at each level until the latest bucket in
each level can hold the time specified.
extract returns a slice of specified number of observations from a given
level over a given range.
init initializes a level according to the supplied criteria.
mergePendingUpdates applies the pending updates into all levels.
mergeValue inserts the observation at the specified time in the past into all levels.
resetObservation clears the content so the struct may be reused.
func NewMinuteHourSeries(f func() Observable) *MinuteHourSeries
func NewMinuteHourSeriesWithClock(f func() Observable, clock Clock) *MinuteHourSeries
An Observable is a kind of data that can be aggregated in a time series.
// Adds the data from a different observation to self
// Clears the observation so it can be reused.
// Copies the contents of a given observation to self
// Multiplies the data in self by a given ratio
*Float
*golang.org/x/net/trace.histogram
func NewFloat() Observable
func (*MinuteHourSeries).Hour() Observable
func (*MinuteHourSeries).Minute() Observable
func (*Float).Add(other Observable)
func (*Float).CopyFrom(other Observable)
func Observable.Add(other Observable)
func Observable.CopyFrom(other Observable)
TimeSeries tracks data at granularities from 1 second to 16 weeks.
timeSeriestimeSeries
// Clock for getting current time
// if there are pending observations
// time of last Observable tracked
// levels of bucketed Observable
// number of buckets in each level
// observations not yet bucketed
// what time are we keeping in pending
// make more Observable
// convenient aggregation of all Observable
Add records an observation at the current time.
AddWithTime records an observation at the specified time.
Clear removes all observations from the time series.
ComputeRange computes a specified number of values into a slice using
the observations recorded over the specified time period. The return
values are approximate if the start or finish times don't fall on the
bucket boundaries at the same level or if the number of buckets spanning
the range is not an integral multiple of num.
Latest returns the sum of the num latest buckets from the level.
LatestBuckets returns a copy of the num latest buckets from level.
Range returns the sum of observations added over the specified time range.
If start or finish times don't fall on bucket boundaries of the same
level, then return values are approximate answers.
Recent returns the sum of observations from the last delta.
RecentList returns the specified number of values in slice over the most
recent time period of the specified range.
ScaleBy updates observations by scaling by factor.
Total returns the total of all observations.
advance cycles the buckets at each level until the latest bucket in
each level can hold the time specified.
extract returns a slice of specified number of observations from a given
level over a given range.
init initializes a level according to the supplied criteria.
mergePendingUpdates applies the pending updates into all levels.
mergeValue inserts the observation at the specified time in the past into all levels.
resetObservation clears the content so the struct may be reused.
func NewTimeSeries(f func() Observable) *TimeSeries
func NewTimeSeriesWithClock(f func() Observable, clock Clock) *TimeSeries
Each level is represented by a sequence of buckets. Each bucket spans an
interval equal to the resolution of the level. New observations are added
to the last bucket.
// Clock for getting current time
// if there are pending observations
// time of last Observable tracked
// levels of bucketed Observable
// number of buckets in each level
// observations not yet bucketed
// what time are we keeping in pending
// make more Observable
// convenient aggregation of all Observable
Add records an observation at the current time.
AddWithTime records an observation at the specified time.
Clear removes all observations from the time series.
ComputeRange computes a specified number of values into a slice using
the observations recorded over the specified time period. The return
values are approximate if the start or finish times don't fall on the
bucket boundaries at the same level or if the number of buckets spanning
the range is not an integral multiple of num.
Latest returns the sum of the num latest buckets from the level.
LatestBuckets returns a copy of the num latest buckets from level.
Range returns the sum of observations added over the specified time range.
If start or finish times don't fall on bucket boundaries of the same
level, then return values are approximate answers.
Recent returns the sum of observations from the last delta.
RecentList returns the specified number of values in slice over the most
recent time period of the specified range.
ScaleBy updates observations by scaling by factor.
Total returns the total of all observations.
advance cycles the buckets at each level until the latest bucket in
each level can hold the time specified.
extract returns a slice of specified number of observations from a given
level over a given range.
init initializes a level according to the supplied criteria.
mergePendingUpdates applies the pending updates into all levels.
mergeValue inserts the observation at the specified time in the past into all levels.
resetObservation clears the content so the struct may be reused.
Information kept per level. Each level consists of a circular list of
observations. The start of the level may be derived from end and the
len(buckets) * sizeInMillis.
// collections of observations
// end timestamp for this level
// index to newest bucketed Observable
// index to oldest bucketed Observable
// used for creating new Observable
// duration of the bucketed Observable
(*tsLevel) Clear()(*tsLevel) InitLevel(size time.Duration, numBuckets int, f func() Observable)
Package-Level Functions (total 7, in which 5 are exported)
NewFloat returns a Float.
NewMinuteHourSeries creates a new MinuteHourSeries using the function provided for creating new Observable.
NewMinuteHourSeriesWithClock creates a new MinuteHourSeries using the function provided for creating new Observable and the clock for
assigning timestamps.
NewTimeSeries creates a new TimeSeries using the function provided for creating new Observable.
NewTimeSeriesWithClock creates a new TimeSeries using the function provided for creating new Observable and the clock for
assigning timestamps.