helper

package
v6.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP(base mb.BaseMetricSet) *HTTP

NewHTTP creates new http helper

func (*HTTP) FetchContent

func (h *HTTP) FetchContent() ([]byte, error)

FetchContent makes an HTTP request to the configured url and returns the body content.

func (*HTTP) FetchJSON

func (h *HTTP) FetchJSON() (map[string]interface{}, error)

FetchJSON makes an HTTP request to the configured url and returns the JSON content. This only works if the JSON output needed is in map[string]interface format.

func (*HTTP) FetchResponse

func (h *HTTP) FetchResponse() (*http.Response, error)

FetchResponse fetches a response for the http metricset. It's important that resp.Body has to be closed if this method is used. Before using this method check if one of the other Fetch* methods could be used as they ensure that the Body is properly closed.

func (*HTTP) FetchScanner

func (h *HTTP) FetchScanner() (*bufio.Scanner, error)

FetchScanner returns a Scanner for the content.

func (*HTTP) SetBody

func (h *HTTP) SetBody(body []byte)

func (*HTTP) SetHeader

func (h *HTTP) SetHeader(key, value string)

func (*HTTP) SetMethod

func (h *HTTP) SetMethod(method string)

func (*HTTP) SetURI

func (h *HTTP) SetURI(uri string)

type Prometheus

type Prometheus struct {
	HTTP
}

Prometheus helper retrieves prometheus formatted metrics

func NewPrometheusClient

func NewPrometheusClient(base mb.BaseMetricSet) *Prometheus

NewPrometheusClient creates new prometheus helper

func (*Prometheus) GetFamilies

func (p *Prometheus) GetFamilies() ([]*dto.MetricFamily, error)

GetFamilies requests metric families from prometheus endpoint and returns them

Directories

Path Synopsis
tcp
udp

Jump to

Keyboard shortcuts

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