prometheus

package
v0.0.0-...-d423f26 Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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

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.
}

func NewFamily

func NewFamily(dtoMF *dto.MetricFamily) *Family

NewFamily consumes a MetricFamily and transforms it to the local Family type.

func (*Family) AddLabel

func (f *Family) AddLabel(key, val string)

AddLabel allows to add key/value labels to an already existing Family.

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.

type Metric

type Metric struct {
	Labels map[string]string `json:"labels,omitempty"`
	Value  string            `json:"value"`
}

Metric is for all "single value" metrics, i.e. Counter, Gauge, and Untyped.

type Summary

type Summary struct {
	Labels    map[string]string `json:"labels,omitempty"`
	Quantiles map[string]string `json:"quantiles,omitempty"`
	Count     string            `json:"count"`
	Sum       string            `json:"sum"`
}

Summary mirrors the Summary proto message.

Jump to

Keyboard shortcuts

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