model

package
v2.0.0-beta2.0...-3469a79 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalTSOrVectorWriter

func MarshalTSOrVectorWriter(ts timeseries.Timeseries, rlo *timeseries.RequestOptions,
	status int, w io.Writer, isVector bool) error

marshalTSOrVectorWriter writes matrix and vector outputs to the provided io.Writer

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, rlo *timeseries.RequestOptions, status int, w io.Writer) error

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

func MergeAndWriteAlerts

func MergeAndWriteAlerts(w http.ResponseWriter, r *http.Request, rgs merge.ResponseGates)

MergeAndWriteAlerts merges the provided Responses into a single prometheus Alerts data object, and writes it to the provided ResponseWriter

func MergeAndWriteLabelData

func MergeAndWriteLabelData(w http.ResponseWriter, r *http.Request, rgs merge.ResponseGates)

MergeAndWriteLabelData merges the provided Responses into a single prometheus basic data object, and writes it to the provided ResponseWriter

func MergeAndWriteSeries

func MergeAndWriteSeries(w http.ResponseWriter, r *http.Request, rgs merge.ResponseGates)

MergeAndWriteSeries merges the provided Responses into a single prometheus Series data object, and writes it to the provided ResponseWriter

func MergeAndWriteVector

func MergeAndWriteVector(w http.ResponseWriter, r *http.Request, rgs merge.ResponseGates)

MergeAndWriteVector merges the provided Responses into a single prometheus Vector data object, and writes it to the provided ResponseWriter

func NewModeler

func NewModeler() *timeseries.Modeler

NewModeler returns a collection of modeling functions for prometheus interoperability

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 Envelope

type Envelope struct {
	Status    string   `json:"status"`
	ErrorType string   `json:"errorType,omitempty"`
	Error     string   `json:"error,omitempty"`
	Warnings  []string `json:"warnings,omitempty"`
}

Envelope represents a Proemtheus Response Envelope Root Type

func (*Envelope) Merge

func (e *Envelope) Merge(e2 *Envelope)

Merge combines the passed envelope data with the subject data

func (*Envelope) StartMarshal

func (e *Envelope) StartMarshal(w io.Writer, httpStatus int)

StartMarshal writes the opening envelope data to the wire; the caller must Close the envelope by writing "}" after writing the data block

type WFAlert

type WFAlert struct {
	ActiveAt    string            `json:"activeAt,omitempty"`
	Annotations map[string]string `json:"annotations"`
	Labels      map[string]string `json:"labels"`
	State       string            `json:"state"`
	Value       string            `json:"value,omitempty"`
}

WFAlert is the Wire Format Document for the alert object in /alerts responses

func (*WFAlert) CalculateHash

func (a *WFAlert) CalculateHash() uint64

CalculateHash sums the FNV64a hash for the Header and stores it to the Hash member

type WFAlertData

type WFAlertData struct {
	Alerts []WFAlert `json:"alerts"`
}

WFAlertData is the Wire Format Document for the alerts list in /alerts responses

type WFAlerts

type WFAlerts struct {
	*Envelope
	Data *WFAlertData `json:"data"`
}

WFAlerts is the Wire Format Document for the /alerts endpoint

func (*WFAlerts) Merge

func (a *WFAlerts) Merge(results ...*WFAlerts)

Merge merges the passed WFAlerts into the subject WFAlerts by preferring higher-severity states during de-duplication

type WFLabelData

type WFLabelData struct {
	*Envelope
	Data []string `json:"data"`
}

WFLabelData is the Wire Format Document for the /labels and /label/<name>/values endpoints and will work for any other response where Data is a string slice

func (*WFLabelData) Merge

func (ld *WFLabelData) Merge(results ...*WFLabelData)

Merge merges the passed WFSeries into the subject WFSeries

type WFMatrixData

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

WFMatrixData is the data section of the WFD for timeseries responses

type WFMatrixDocument

type WFMatrixDocument struct {
	*Envelope
	Data WFMatrixData `json:"data"`
}

WFMatrixDocument is the Wire Format Document for prometheus range / timeseries

type WFResult

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

WFResult is the Result section of the WFD

type WFSeries

type WFSeries struct {
	*Envelope
	Data []WFSeriesData `json:"data"`
}

WFSeries is the Wire Format Document for the /series endpoint

func (*WFSeries) Merge

func (s *WFSeries) Merge(results ...*WFSeries)

Merge merges the passed WFSeries into the subject WFSeries

type WFSeriesData

type WFSeriesData struct {
	Name     string `json:"__name__"`
	Instance string `json:"instance"`
	Job      string `json:"job"`
}

WFSeriesData describes the wire format document for series data elements

Jump to

Keyboard shortcuts

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