Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Label ¶
A Label is a Name and Value pair that provides additional information about the metric. It is metadata for the metric. For example, Kubernetes pod metrics always have 'namespace' label that represents which namespace the pod belongs to.
type PrometheusQuery ¶
PrometheusQuery represents parameters for querying Prometheus
func NewPrometheusQuery ¶
func NewPrometheusQuery(host string, port int, client *http.Client) PrometheusQuery
NewPrometheusQuery create a NewPrometheusQuery
func (PrometheusQuery) Fetch ¶
func (q PrometheusQuery) Fetch(query string) (*VectorQueryResponse, error)
Fetch queries aggregated stats
func (PrometheusQuery) Query ¶
func (q PrometheusQuery) Query(query string, time time.Time) ([]*TimeSeries, error)
TODO(xieydd) Refactor PrometheusQuery Query queries Prometheus with given query string and time
type PrometheusQueryFetcher ¶
type PrometheusQueryFetcher interface {
Fetch(query string) (*VectorQueryResponse, error)
}
type TimeSeries ¶
type TimeSeries struct { // A collection of Labels that are attached by monitoring system as metadata // for the metrics, which are known as dimensions. Labels []Label // A collection of Samples in chronological order. Samples []Sample }
Ref: https://github.com/gocrane/crane/blob/9aaeb2aa9cf9f43a31842b4663e48bc47ac05f17/pkg/common/types.go TimeSeries is a stream of samples that belong to a metric with a set of labels
func NewTimeSeries ¶
func NewTimeSeries() *TimeSeries
func (*TimeSeries) AppendLabel ¶
func (ts *TimeSeries) AppendLabel(key, val string)
func (*TimeSeries) AppendSample ¶
func (ts *TimeSeries) AppendSample(timestamp int64, val float64)
func (*TimeSeries) SetLabels ¶
func (ts *TimeSeries) SetLabels(labels []Label)
func (*TimeSeries) SetSamples ¶
func (ts *TimeSeries) SetSamples(samples []Sample)
func (*TimeSeries) SortSampleAsc ¶
func (ts *TimeSeries) SortSampleAsc()
type VectorQueryResponse ¶
type VectorQueryResponse struct { Data struct { Result []struct { Metric struct { InferenceName string `json:"inference_name"` } Value []interface{} `json:"value"` } } }