test

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package test will scrape a target and you can inspect the variables. Basic usage:

result := Scrape("http://localhost:9153/metrics")
v := MetricValue("coredns_cache_capacity", result)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricValue

func MetricValue(name string, mfs []*MetricFamily) (string, map[string]string)

MetricValue returns the value associated with name as a string as well as the labels. It only returns the first metrics of the slice.

func MetricValueLabel

func MetricValueLabel(name, label string, mfs []*MetricFamily) (string, map[string]string)

MetricValueLabel returns the value for name *and* label *value*.

Types

type MetricFamily

type MetricFamily struct {
	Name    string        `json:"name"`
	Help    string        `json:"help"`
	Type    string        `json:"type"`
	Metrics []interface{} `json:"metrics,omitempty"` // Either metric or summary.
}

MetricFamily holds a prometheus metric.

func Scrape

func Scrape(t *testing.T, url string) []*MetricFamily

Scrape returns the all the vars a []*metricFamily.

Jump to

Keyboard shortcuts

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