utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RelativeIntervalToRange

func RelativeIntervalToRange(ri RelativeInterval, origin model.Time, step time.Duration) prom.Range

ToRange converts the relative interval to a prom.Range.

The origin is used to calculate the absolute timestamps in the samples.

func RelativeIntervalsToRangeVectors

func RelativeIntervalsToRangeVectors(
	intervals []RelativeInterval, origin model.Time, step time.Duration) prom.RangeVector

RelativeIntervalsToRangeVectors converts a slice of relative intervals to a prom.RangeVector.

Types

type RelativeInterval

type RelativeInterval struct {
	Labels map[string]string
	Start  int // relative start in minutes
	End    int // relative end in minutes
}

RelativeInterval represents a labeled interval with relative start and end times.

It can be used to generate various data structures for testing purposes, such as prom.Range or [processor.Interval].

Jump to

Keyboard shortcuts

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