Documentation
¶
Index ¶
- func MakeMergeFunc[T any, PT merge.Mergeable[T]](errorType string, newInstance func() PT) merge.MergeFunc
- func MakeMergeFuncFromBytes[T any, PT merge.Mergeable[T]](errorType string, newInstance func() PT) func(*merge.Accumulator, []byte, int) error
- func MakeRespondFunc[T any, PT merge.MarshallerPtr[T]](handleResult func(http.ResponseWriter, *http.Request, PT, int)) merge.RespondFunc
- func MarshalTSOrVectorWriter(ts timeseries.Timeseries, _ *timeseries.RequestOptions, status int, ...) error
- func MarshalTimeseries(ts timeseries.Timeseries, rlo *timeseries.RequestOptions, status int) ([]byte, error)
- func MarshalTimeseriesWriter(ts timeseries.Timeseries, rlo *timeseries.RequestOptions, status int, ...) error
- func MergeAndWriteAlertsMergeFunc() merge.MergeFunc
- func MergeAndWriteAlertsRespondFunc() merge.RespondFunc
- func MergeAndWriteLabelDataMergeFunc() merge.MergeFunc
- func MergeAndWriteLabelDataRespondFunc() merge.RespondFunc
- func MergeAndWriteSeriesMergeFunc() merge.MergeFunc
- func MergeAndWriteSeriesRespondFunc() merge.RespondFunc
- func MergeAndWriteVectorMergeFunc(unmarshaler timeseries.UnmarshalerFunc) merge.MergeFunc
- func MergeAndWriteVectorRespondFunc(marshaler timeseries.MarshalWriterFunc) merge.RespondFunc
- func NewModeler() *timeseries.Modeler
- func UnmarshalTimeseries(data []byte, trq *timeseries.TimeRangeQuery) (timeseries.Timeseries, error)
- func UnmarshalTimeseriesReader(reader io.Reader, trq *timeseries.TimeRangeQuery) (timeseries.Timeseries, error)
- type Envelope
- type ResultType
- type WFAlert
- type WFAlertData
- type WFAlerts
- type WFHistogram
- type WFHistogramSpan
- type WFLabelData
- type WFMatrixData
- type WFMatrixDocument
- type WFResult
- type WFResultScalar
- type WFSeries
- type WFSeriesData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMergeFunc ¶
func MakeMergeFunc[T any, PT merge.Mergeable[T]](errorType string, newInstance func() PT, ) merge.MergeFunc
MakeMergeFunc creates a MergeFunc for a specific type that implements Merge The returned function accepts a type conforming to Mergeable[T] and merges it into the accumulator
func MakeMergeFuncFromBytes ¶
func MakeMergeFuncFromBytes[T any, PT merge.Mergeable[T]](errorType string, newInstance func() PT, ) func(*merge.Accumulator, []byte, int) error
MakeMergeFuncFromBytes creates a MergeFunc that accepts []byte and unmarshals it This is a convenience function for call sites that still have []byte
func MakeRespondFunc ¶
func MakeRespondFunc[T any, PT merge.MarshallerPtr[T]]( handleResult func(http.ResponseWriter, *http.Request, PT, int), ) merge.RespondFunc
MakeRespondFunc creates a RespondFunc for a specific type that implements MarshallerPtr
func MarshalTSOrVectorWriter ¶
func MarshalTSOrVectorWriter(ts timeseries.Timeseries, _ *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 MergeAndWriteAlertsMergeFunc ¶
MergeAndWriteAlertsMergeFunc returns a MergeFunc for WFAlerts
func MergeAndWriteAlertsRespondFunc ¶
func MergeAndWriteAlertsRespondFunc() merge.RespondFunc
MergeAndWriteAlertsRespondFunc returns a RespondFunc for WFAlerts
func MergeAndWriteLabelDataMergeFunc ¶
MergeAndWriteLabelDataMergeFunc returns a MergeFunc for WFLabelData
func MergeAndWriteLabelDataRespondFunc ¶
func MergeAndWriteLabelDataRespondFunc() merge.RespondFunc
MergeAndWriteLabelDataRespondFunc returns a RespondFunc for WFLabelData
func MergeAndWriteSeriesMergeFunc ¶
MergeAndWriteSeriesMergeFunc returns a MergeFunc for WFSeries
func MergeAndWriteSeriesRespondFunc ¶
func MergeAndWriteSeriesRespondFunc() merge.RespondFunc
MergeAndWriteSeriesRespondFunc returns a RespondFunc for WFSeries
func MergeAndWriteVectorMergeFunc ¶
func MergeAndWriteVectorMergeFunc(unmarshaler timeseries.UnmarshalerFunc) merge.MergeFunc
MergeAndWriteVectorMergeFunc returns a MergeFunc for Vector (timeseries)
func MergeAndWriteVectorRespondFunc ¶
func MergeAndWriteVectorRespondFunc(marshaler timeseries.MarshalWriterFunc) merge.RespondFunc
MergeAndWriteVectorRespondFunc returns a RespondFunc for Vector (timeseries)
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
type ResultType ¶
type ResultType string
const ( Scalar ResultType = "scalar" Vector ResultType = "vector" Matrix ResultType = "matrix" )
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 ¶
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
type WFHistogram ¶ added in v2.0.2
type WFHistogram struct {
Count string `json:"count"`
Sum string `json:"sum"`
Schema int `json:"schema"`
ZeroThreshold float64 `json:"zero_threshold"`
ZeroCount string `json:"zero_count"`
NegativeSpans []WFHistogramSpan `json:"negative_spans,omitempty"`
NegativeDeltas []int64 `json:"negative_deltas,omitempty"`
NegativeCounts []string `json:"negative_counts,omitempty"`
PositiveSpans []WFHistogramSpan `json:"positive_spans,omitempty"`
PositiveDeltas []int64 `json:"positive_deltas,omitempty"`
PositiveCounts []string `json:"positive_counts,omitempty"`
Buckets [][]any `json:"buckets,omitempty"`
CustomValues []float64 `json:"custom_values,omitempty"`
}
WFHistogram represents a Prometheus native histogram sample in the JSON wire format returned by the Prometheus HTTP API.
type WFHistogramSpan ¶ added in v2.0.2
WFHistogramSpan represents a span in a native histogram bucket layout.
type WFLabelData ¶
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 ResultType `json:"resultType"`
MatrixResults []*WFResult `json:"-"`
ScalarResult WFResultScalar `json:"-"`
}
WFMatrixData is the data section of the WFD for timeseries responses
func (*WFMatrixData) UnmarshalJSON ¶ added in v2.0.2
func (d *WFMatrixData) UnmarshalJSON(data []byte) error
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 [][]any `json:"values,omitempty"`
Value []any `json:"value,omitempty"`
Histograms [][]any `json:"histograms,omitempty"`
Histogram []any `json:"histogram,omitempty"`
}
WFResult is the Result section of the WFD (matrix and vector only)
type WFResultScalar ¶
type WFResultScalar []any
WFResultScalar is the Result section of the WFD (scalar only)
type WFSeries ¶
type WFSeries struct {
*Envelope
Data []WFSeriesData `json:"data"`
}
WFSeries is the Wire Format Document for the /series endpoint
type WFSeriesData ¶
WFSeriesData is a single label set as returned by Prometheus /api/v1/series. Prometheus series carry an arbitrary label set (e.g. shard, region, cluster), so a fixed struct would silently drop data on round-trip and collapse otherwise-distinct series during merge.