Documentation

Overview

    Package cumulative creates Count metrics from cumulative values.

    Example
    Output:
    
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type DeltaCalculator

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

      DeltaCalculator is used to create Count metrics from cumulative values.

      func NewDeltaCalculator

      func NewDeltaCalculator() *DeltaCalculator

        NewDeltaCalculator creates a new DeltaCalculator. A single DeltaCalculator stores all cumulative values seen in order to compute deltas.

        func (*DeltaCalculator) CountMetric

        func (dc *DeltaCalculator) CountMetric(name string, attributes map[string]interface{}, val float64, now time.Time) (count telemetry.Count, valid bool)

          CountMetric creates a count metric from the difference between the values and timestamps of multiple calls. If this is the first time the name/attributes combination has been seen then the `valid` return value will be false.

          func (*DeltaCalculator) SetExpirationAge

          func (dc *DeltaCalculator) SetExpirationAge(age time.Duration) *DeltaCalculator

            SetExpirationAge configures how old entries must be for expiration. The default is twenty minutes.

            func (*DeltaCalculator) SetExpirationCheckInterval

            func (dc *DeltaCalculator) SetExpirationCheckInterval(interval time.Duration) *DeltaCalculator

              SetExpirationCheckInterval configures how often to check for expired entries. The default is twenty minutes.

              Source Files