gtime

package
v0.0.0-...-915dd30 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatInterval

func FormatInterval(inter time.Duration) string

FormatInterval converts a duration into the units that Grafana uses

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 ParseDuration

func ParseDuration(inp string) (time.Duration, error)

ParseDuration parses a duration with support for all units that Grafana uses. Durations are independent of wall time.

func ParseInterval

func ParseInterval(inp string) (time.Duration, error)

ParseInterval parses an interval with support for all units that Grafana uses. An interval is relative to the current wall time.

func ParseIntervalStringToTimeDuration

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

ParseIntervalStringToTimeDuration converts a string representation of a expected (i.e. 1m30s) to time.Duration this method copied from grafana/grafana/pkg/tsdb/intervalv2.go

func RoundInterval

func RoundInterval(interval time.Duration) time.Duration

RoundInterval returns a predetermined, lower and rounder duration than the given

Types

This section is empty.

Jump to

Keyboard shortcuts

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