intervalv2

package
v0.0.0-test.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRes int64 = 1500
)

Functions

func FormatDuration

func FormatDuration(inter time.Duration) string

FormatDuration converts a duration into the kbn format e.g. 1m 2h or 3d

func GetIntervalFrom

func GetIntervalFrom(dsInterval, queryInterval string, queryIntervalMS int64, defaultInterval time.Duration) (time.Duration, error)

GetIntervalFrom returns the minimum interval. dsInterval is the string representation of data source min interval, if configured. queryInterval is the string representation of query interval (min interval), e.g. "10ms" or "10s". queryIntervalMS is a pre-calculated numeric representation of the query interval in milliseconds.

func NewCalculator

func NewCalculator(opts ...CalculatorOptions) *intervalCalculator

func ParseIntervalStringToTimeDuration

func ParseIntervalStringToTimeDuration(interval string) (time.Duration, error)

Types

type Calculator

type Calculator interface {
	Calculate(timerange backend.TimeRange, minInterval time.Duration, maxDataPoints int64) Interval
	CalculateSafeInterval(timerange backend.TimeRange, resolution int64) Interval
}

type CalculatorOptions

type CalculatorOptions struct {
	MinInterval time.Duration
}

type Interval

type Interval struct {
	Text  string
	Value time.Duration
}

func (*Interval) Milliseconds

func (i *Interval) Milliseconds() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL