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 GetLocalTimezoneOffsetNsecs() int64
- 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 Ptr[T any](v T) *T
- func ReplaceTemplateVariable(expr string, interval int64, timeRange backend.TimeRange) string
- func TryParseTimestampRFC3339Nano(s string) (int64, bool)
- 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 GetLocalTimezoneOffsetNsecs ¶ added in v0.19.0
func GetLocalTimezoneOffsetNsecs() int64
GetLocalTimezoneOffsetNsecs returns local timezone offset in nanoseconds. It accounts for DST automatically.
func ParseDuration ¶
ParseDuration parses duration string in Prometheus format
func ParseTime ¶
ParseTime parses time s in different formats.
See https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#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/victoriametrics/single-server-victoriametrics/#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 TryParseTimestampRFC3339Nano ¶ added in v0.19.0
TryParseTimestampRFC3339Nano parses s as RFC3339 with optional nanoseconds part and timezone offset and returns unix timestamp in nanoseconds.
If s doesn't contain timezone offset, then the local timezone is used.
The returned timestamp can be negative if s is smaller than 1970 year.x
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