Documentation
¶
Index ¶
- func QueryInstant(baseURL string, timeout time.Duration, expression string, ts time.Time, ...) error
- func QueryRanged(baseURL string, timeout time.Duration, expression string, start time.Time, ...) error
- type DataPoint
- type ResultType
- type SimpleInstantSample
- type SimpleInstantVector
- type SimpleRangedMatrix
- type SimpleRangedSampleStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryInstant ¶
func QueryInstant(baseURL string, timeout time.Duration, expression string, ts time.Time, outVector interface{}) error
QueryInstant queries Prometheus at an instant time and returns a vector.
The outVector argument may be a reference to a slice of custom struct or a SimpleInstantVector
func QueryRanged ¶
func QueryRanged(baseURL string, timeout time.Duration, expression string, start time.Time, end time.Time, step int, outMatrix interface{}) error
QueryRanged queries Prometheus for a time range and returns a matrix.
The outMatrix argument may be a reference to a slice of custom struct or a SimpleRangedMatrix
Types ¶
type DataPoint ¶
type DataPoint struct {
Time time.Time // Time is the timestamp when this data point is sampled
Value float64 // Value is the numeric value of this data point
}
DataPoint represents a sampled value, returned from Prometheus as [timestamp, numeric value]
func (*DataPoint) UnmarshalJSON ¶
UnmarshalJSON provides custom JSON unmarshalling
type ResultType ¶
type ResultType string
ResultType defines the result type from Prometheus queries
const ( InstantVector ResultType = "vector" RangedVector ResultType = "matrix" )
Result types from Prometheus query
type SimpleInstantSample ¶
type SimpleInstantSample struct {
Metric map[string]string `json:"metric"` // Metric contains labels and label values of this sample
Value DataPoint `json:"value"` // Value is the sampled value from instant queries
}
SimpleInstantSample defines a generic sample returned by Prometheus instant queries
type SimpleInstantVector ¶
type SimpleInstantVector []SimpleInstantSample
SimpleInstantVector defines a generic vector returned by Prometheus instant queries
A reference of SimpleInstantVector can be used directly as the "outVector" argument to the QueryInstant function
type SimpleRangedMatrix ¶
type SimpleRangedMatrix []SimpleRangedSampleStream
SimpleRangedMatrix defines a generic matrix returned by Prometheus ranged queries
A reference of SimpleRangedMatrix can be used directly as the "outMatrix" argument to the QueryRanged function
type SimpleRangedSampleStream ¶
type SimpleRangedSampleStream struct {
Metric map[string]string `json:"metric"` // Metric contains labels and label values of this sample
Values []DataPoint `json:"values"` // Values contains a stream of sampled values from ranged queries
}
SimpleRangedSampleStream defines a generic sample stream returned by Prometheus ranged queries