model

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package model is a test utility package that serializes between a *DataSet and the Prometheus HTTP API JSON Format

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalTimeseries

func MarshalTimeseries(ts timeseries.Timeseries, rlo *timeseries.RequestOptions, status int) ([]byte, error)

MarshalTimeseries converts a Timeseries into a JSON blob

func MarshalTimeseriesWriter

func MarshalTimeseriesWriter(ts timeseries.Timeseries,
	_ *timeseries.RequestOptions, _ int, w io.Writer,
) error

MarshalTimeseriesWriter converts a Timeseries into a JSON blob via an io.Writer

func Modeler

func Modeler() *timeseries.Modeler

Modeler returns a default Modeler

func UnmarshalTimeseries

func UnmarshalTimeseries(data []byte, trq *timeseries.TimeRangeQuery) (timeseries.Timeseries, error)

UnmarshalTimeseries converts a JSON blob into a Timeseries

func UnmarshalTimeseriesReader

func UnmarshalTimeseriesReader(reader io.Reader, trq *timeseries.TimeRangeQuery) (timeseries.Timeseries, error)

UnmarshalTimeseriesReader converts a JSON blob into a Timeseries via io.Reader

Types

type WFData

type WFData struct {
	ResultType string     `json:"resultType"`
	Results    []WFResult `json:"result"`
}

WFData is the data section of the WFD

type WFDocument

type WFDocument struct {
	Status string `json:"status"`
	Data   WFData `json:"data"`
}

WFDocument the Wire Format Document for the timeseries

type WFResult

type WFResult struct {
	Metric dataset.Tags `json:"metric"`
	Values [][]any      `json:"values"`
	Value  []any        `json:"value"`
}

WFResult is the Result section of the WFD

Jump to

Keyboard shortcuts

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