Documentation
¶
Index ¶
- func FetchMetricFamilies(url string, ch chan<- *dto.MetricFamily, certificate string, key string, ...) error
- func ParseReader(in io.Reader, ch chan<- *dto.MetricFamily) error
- func ParseResponse(resp *http.Response, ch chan<- *dto.MetricFamily) error
- type Family
- type Histogram
- type Metric
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchMetricFamilies ¶
func FetchMetricFamilies( url string, ch chan<- *dto.MetricFamily, certificate string, key string, skipServerCertCheck bool, ) error
FetchMetricFamilies retrieves metrics from the provided URL, decodes them into MetricFamily proto messages, and sends them to the provided channel. It returns after all MetricFamilies have been sent.
func ParseReader ¶ added in v1.1.0
func ParseReader(in io.Reader, ch chan<- *dto.MetricFamily) error
ParseReader consumes an io.Reader and pushes it to the MetricFamily channel. It returns when all MetricFamilies are parsed and put on the channel.
func ParseResponse ¶
func ParseResponse(resp *http.Response, ch chan<- *dto.MetricFamily) error
ParseResponse consumes an http.Response and pushes it to the MetricFamily channel. It returns when all MetricFamilies are parsed and put on the channel.
Types ¶
type Family ¶
type Family struct {
//Time time.Time
Name string `json:"name"`
Help string `json:"help"`
Type string `json:"type"`
Metrics []interface{} `json:"metrics,omitempty"` // Either metric or summary.
}
Family mirrors the MetricFamily proto message.
func NewFamily ¶
func NewFamily(dtoMF *dto.MetricFamily) *Family
NewFamily consumes a MetricFamily and transforms it to the local Family type.
type Histogram ¶
type Histogram struct {
Labels map[string]string `json:"labels,omitempty"`
Buckets map[string]string `json:"buckets,omitempty"`
Count string `json:"count"`
Sum string `json:"sum"`
}
Histogram mirrors the Histogram proto message.