Documentation
¶
Index ¶
- Constants
- func CleanDurationString(duration string) string
- func DurationOffsetStrings(duration, offset time.Duration) (string, string)
- func DurationString(duration time.Duration) string
- func DurationToPromOffsetString(duration time.Duration) string
- func FormatDurationStringDaysToHours(param string) (string, error)
- func FormatStoreResolution(dur time.Duration) string
- func ParseDuration(duration string) (time.Duration, error)
- func ParseTimeRange(duration, offset time.Duration) (time.Time, time.Time)
- type JobTicker
- type ProfileDataSeries
- type ProfileDatum
Constants ¶
const ( // SecsPerMin expresses the amount of seconds in a minute SecsPerMin = 60.0 // SecsPerHour expresses the amount of seconds in a minute SecsPerHour = 3600.0 // SecsPerDay expressed the amount of seconds in a day SecsPerDay = 86400.0 // MinsPerHour expresses the amount of minutes in an hour MinsPerHour = 60.0 // MinsPerDay expresses the amount of minutes in a day MinsPerDay = 1440.0 // HoursPerDay expresses the amount of hours in a day HoursPerDay = 24.0 // HoursPerMonth expresses the amount of hours in a month HoursPerMonth = 730.0 // DaysPerMonth expresses the amount of days in a month DaysPerMonth = 30.42 // Day expresses 24 hours Day = time.Hour * 24.0 )
Variables ¶
This section is empty.
Functions ¶
func CleanDurationString ¶
CleanDurationString removes prometheus formatted prefix "offset " allong with leading a trailing whitespace from duration string, leaving behind a string with format [0-9+](s|m|d|h)
func DurationOffsetStrings ¶
DurationOffsetStrings converts a (duration, offset) pair to Prometheus- compatible strings in terms of days, hours, minutes, or seconds.
func DurationString ¶
DurationString converts a duration to a Prometheus-compatible string in terms of days, hours, minutes, or seconds.
func DurationToPromOffsetString ¶
DurationToPromOffsetString returns a Prometheus formatted string with leading offset or empty string if given a negative duration
func FormatDurationStringDaysToHours ¶
FormatDurationStringDaysToHours converts string from format [0-9+]d to [0-9+]h
func FormatStoreResolution ¶
FormatStoreResolution provides a clean notation for ETL store resolutions. e.g. daily => 1d; hourly => 1h
func ParseDuration ¶
ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d"
Types ¶
type JobTicker ¶
JobTicker is a ticker used to synchronize the next run of a repeating process. The designated use-case is for infinitely-looping selects, where a timeout or an exit channel might cancel the process, but otherwise the intent is to wait at the select for some amount of time until the next run. This differs from a standard ticker, which ticks without waiting and drops any missed ticks; rather, this ticker must be kicked off manually for each tick, so that after the current run of the job completes, the timer starts again.
type ProfileDataSeries ¶
type ProfileDataSeries struct { Name string Series []*ProfileDatum }
func NewProfileDataSeries ¶
func NewProfileDataSeries(name string, steps int) *ProfileDataSeries
func (*ProfileDataSeries) Start ¶
func (pds *ProfileDataSeries) Start()
func (*ProfileDataSeries) Step ¶
func (pds *ProfileDataSeries) Step(name string)
func (*ProfileDataSeries) Stop ¶
func (pds *ProfileDataSeries) Stop()
func (*ProfileDataSeries) String ¶
func (pds *ProfileDataSeries) String() string