Documentation
¶
Index ¶
- func AddTimeFieldWithRange(expr string, timeRange backend.TimeRange) string
- func CalculateStep(minInterval time.Duration, timeRange backend.TimeRange, maxDataPoints int64) time.Duration
- func GetIntervalFrom(dsInterval, queryInterval string, queryIntervalMS int64, ...) (time.Duration, error)
- func GetTime(s string) (time.Time, error)
- func ParseDuration(s string) (time.Duration, error)
- func ParseTime(s string) (float64, error)
- func ParseTimeAt(s string, currentTimestamp float64) (float64, error)
- func ReplaceTemplateVariable(expr string, interval int64, timeRange backend.TimeRange) string
- func WithIntervalVariable(expr string) bool
- type StreamField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTimeFieldWithRange ¶ added in v0.11.0
AddTimeFieldWithRange adds time field with range to the query
func CalculateStep ¶ added in v0.8.0
func CalculateStep(minInterval time.Duration, timeRange backend.TimeRange, maxDataPoints int64) time.Duration
CalculateStep calculates step by provided max datapoints and timerange
func GetIntervalFrom ¶ added in v0.8.0
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 ¶
ParseDuration parses duration string in Prometheus format
func ParseTime ¶
ParseTime parses time s in different formats.
See https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#timestamp-formats
It returns unix timestamp in seconds.
func ParseTimeAt ¶
ParseTimeAt parses time s in different formats, assuming the given currentTimestamp.
See https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#timestamp-formats
It returns unix timestamp in seconds.
func ReplaceTemplateVariable ¶ added in v0.5.0
ReplaceTemplateVariable get query and use it expression to remove grafana template variables with
func WithIntervalVariable ¶ added in v0.8.0
WithIntervalVariable checks if the expression contains interval variable
Types ¶
type StreamField ¶ added in v0.16.1
StreamField represents the label values pair of the _stream fields in the log struct
func ParseStreamFields ¶ added in v0.16.1
func ParseStreamFields(streamFields string) ([]StreamField, error)
ParseStreamFields collect labels values pair from the _stream field