Documentation
¶
Index ¶
- type CalculateFunc
- type Key
- type MapWithExpiry
- func (m *MapWithExpiry) CleanUp(now time.Time)
- func (m *MapWithExpiry) Get(key Key) (*MetricValue, bool)
- func (m *MapWithExpiry) Lock()
- func (m *MapWithExpiry) Set(key Key, value MetricValue)
- func (m *MapWithExpiry) Shutdown() error
- func (m *MapWithExpiry) Size() int
- func (m *MapWithExpiry) Unlock()
- type MetricCalculator
- type MetricValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalculateFunc ¶
CalculateFunc defines how to process metric values by the calculator. It passes previously received MetricValue, and the current raw value and timestamp as parameters. Returns true if the calculation is executed successfully.
type MapWithExpiry ¶
type MapWithExpiry struct {
// contains filtered or unexported fields
}
MapWithExpiry act like a map which provides a method to clean up expired entries. MapWithExpiry is not thread safe and locks must be managed by the owner of the Map by the use of Lock() and Unlock()
func NewMapWithExpiry ¶
func NewMapWithExpiry(ttl time.Duration) *MapWithExpiry
NewMapWithExpiry automatically starts a sweeper to enforce the maps TTL. ShutDown() must be called to ensure that these go routines are properly cleaned up ShutDown() must be called.
func (*MapWithExpiry) CleanUp ¶
func (m *MapWithExpiry) CleanUp(now time.Time)
func (*MapWithExpiry) Get ¶
func (m *MapWithExpiry) Get(key Key) (*MetricValue, bool)
func (*MapWithExpiry) Lock ¶
func (m *MapWithExpiry) Lock()
func (*MapWithExpiry) Set ¶
func (m *MapWithExpiry) Set(key Key, value MetricValue)
func (*MapWithExpiry) Shutdown ¶ added in v0.83.0
func (m *MapWithExpiry) Shutdown() error
func (*MapWithExpiry) Size ¶
func (m *MapWithExpiry) Size() int
func (*MapWithExpiry) Unlock ¶
func (m *MapWithExpiry) Unlock()
type MetricCalculator ¶
type MetricCalculator struct {
// contains filtered or unexported fields
}
MetricCalculator is a calculator used to adjust metric values based on its previous record. Shutdown() must be called to clean up goroutines before program exit.
func NewFloat64DeltaCalculator ¶
func NewFloat64DeltaCalculator() MetricCalculator
func NewMetricCalculator ¶
func NewMetricCalculator(calculateFunc CalculateFunc) MetricCalculator
NewMetricCalculator Creates a metric calculator that enforces a five-minute time to live on cache entries.
func (*MetricCalculator) Calculate ¶
Calculate accepts a new metric value identified by metric key (consists of metric metadata and labels), https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/eacfde3fcbd46ba60a6db0e9a41977390c4883bd/internal/aws/metrics/metric_calculator.go#L88-L91 and delegates the calculation with value and timestamp back to CalculateFunc for the result. Returns true if the calculation is executed successfully.
func (*MetricCalculator) Shutdown ¶ added in v0.83.0
func (rm *MetricCalculator) Shutdown() error