Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Period ¶
type Period interface { fmt.Stringer // Duration is the duration of the retention period Duration() time.Duration // Equal checks whether to retention periods are equal Equal(other Period) bool }
A Period is a named amount of time to retain a given metric
type PeriodsByDuration ¶
type PeriodsByDuration []Period
PeriodsByDuration is a sort.Interface for sorting Periods by Duration, with the shortest duration first
func (PeriodsByDuration) Len ¶
func (rr PeriodsByDuration) Len() int
Len returns the length of the retention rule slice
func (PeriodsByDuration) Less ¶
func (rr PeriodsByDuration) Less(i, j int) bool
Less compares two retention periods by their duration time
func (PeriodsByDuration) Swap ¶
func (rr PeriodsByDuration) Swap(i, j int)
Swap swaps two retention periods in the slice
type PoliciesByPeriod ¶
type PoliciesByPeriod []Policy
PoliciesByPeriod is a sort.Interface for sorting a slice of Policy objects by the duration of their retention period, shortest retention period first
func (PoliciesByPeriod) Len ¶
func (rr PoliciesByPeriod) Len() int
Len returns the length of the retention policies slice
func (PoliciesByPeriod) Less ¶
func (rr PoliciesByPeriod) Less(i, j int) bool
Less compares two retention policies by their retention period. Policies with identical retention periods are sub-sorted by resolution, finest resolution first
func (PoliciesByPeriod) Swap ¶
func (rr PoliciesByPeriod) Swap(i, j int)
Swap swaps two retention policies in the slice
type Policy ¶
type Policy interface { fmt.Stringer // Resolution is the resolution at which the datapoints will be stored Resolution() Resolution // Period is the amount of time to retain the datapoints Period() Period // Equal checks whether this retention policy is equal to another Equal(other Policy) bool }
A Policy describes the resolution and retention period for a set of datapoints (e.g. 1min at 30d)
func MustParsePolicies ¶
MustParsePolicies parses a list of retention policies, panicking if the policies cannot be parsed
func MustParsePolicy ¶
MustParsePolicy parses a retention policy, panicking if the policy cannot be parsed
func ParsePolicies ¶
ParsePolicies parses a list of retention policies in stringified form
func ParsePolicy ¶
ParsePolicy parses a retention policy in the form of resolution:period
type PolicyResolver ¶
type PolicyResolver interface { // ResolveTimeline resolves the retention Policy timeline for a given id ResolveTimeline(id string, from, until time.Time) ([]PolicyTimeRange, error) }
A PolicyResolver resolves policies based on a set of retention rules TODO(mmihic): This should be driven off a RuleProvider, shard, etc.
func NewPolicyResolver ¶
func NewPolicyResolver(p RuleProvider, opts PolicyResolverOptions) (PolicyResolver, error)
NewPolicyResolver returns a new PolicyResolver given a rule provider
type PolicyResolverOptions ¶
type PolicyResolverOptions interface { // Logger is the resolver's logger Logger(logger xlog.Logger) PolicyResolverOptions GetLogger() xlog.Logger // Clock is the resolver's clock Clock(c clock.Clock) PolicyResolverOptions GetClock() clock.Clock }
PolicyResolverOptions are options for creating a PolicyResolver
func NewPolicyResolverOptions ¶
func NewPolicyResolverOptions() PolicyResolverOptions
NewPolicyResolverOptions returns a new set of PolicyResolverOptions
type PolicyTimeRange ¶
type PolicyTimeRange struct { xtime.Range Policy }
A PolicyTimeRange is the application of a retention Policy within a given time range
type Resolution ¶
type Resolution interface { fmt.Stringer // WindowSize is the size of the bucket represented by the resolution WindowSize() time.Duration // Precision defines the precision of datapoints stored at this resolution Precision() xtime.Unit // AlignToStart aligns the given time to the start of the bucket containing that time AlignToStart(t time.Time) time.Time // WindowContaining returns the time range containing the given time at the resolution WindowContaining(t time.Time) xtime.Range // Equal compares this resolution to another Equal(other Resolution) bool }
A Resolution is a sample resolution for datapoints.
func NewResolution ¶
func NewResolution(windowSize time.Duration, precision xtime.Unit) Resolution
NewResolution returns a new resolution
func ParseResolution ¶
func ParseResolution(s string) (Resolution, error)
ParseResolution parses a resolution string
type Rule ¶
type Rule interface { // Policies are the retention policies at the time of the rule, ordered // by retention period (from shorted to longest) Policies() []Policy SetPolicies(p []Policy) Rule // CutoverTime is the time that the rule will begin to be applied CutoverTime() time.Time SetCutoverTime(t time.Time) Rule // CutoffTime is the time that the rule no longer applies CutoffTime() time.Time SetCutoffTime(t time.Time) Rule }
A Rule defines the retention policies that apply to a set of metrics at a particular time. Retention policy can change dynamically over time in response to user actions, so retention rules have a CutoverTime and CutoffTime which determine when the rules apply. When determining which retention periods to query over, the storage manager determines which rule apply within the query time range, then builds a set of sub-queries covering each retention period
type RuleProvider ¶
type RuleProvider interface { // FindRules returns the list of retention rules that apply // for the given id over the requested time range FindRules(id string, start, end time.Time) ([]Rule, error) }
RuleProvider looks up retention rules for a given id and timerange
type RulesByCutoffTime ¶
type RulesByCutoffTime []Rule
RulesByCutoffTime is a sort.Interface for sorting Rules by CutoffTime, with the latest cutoff time first
func (RulesByCutoffTime) Len ¶
func (rr RulesByCutoffTime) Len() int
Len returns the length of the retention rule slice
func (RulesByCutoffTime) Less ¶
func (rr RulesByCutoffTime) Less(i, j int) bool
Less compares two retention rules by their cutoff time
func (RulesByCutoffTime) Swap ¶
func (rr RulesByCutoffTime) Swap(i, j int)
Swap swaps two retention rules in the slice