targets

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAPIEndpoint = "api/v1/targets"

Variables

This section is empty.

Functions

func DropTargetLabels

func DropTargetLabels(series, target labels.Labels) labels.Labels

DropTargetLabels drops labels from the series that are found in the target with exact name/value matches.

Types

type Cache

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

Cache retrieves target information from the Prometheus API and caches it. It works reliably and efficiently for configurations where targets are identified unique by job and instance label and an optional but consistent set of additional labels. It only provides best effort matching for configurations where targets are identified by a varying set of labels within a job and instance combination. Implements TargetGetter.

func NewCache

func NewCache(logger log.Logger, client *http.Client, promURL *url.URL) *Cache

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, lset labels.Labels) (*Target, error)

Get returns a target that matches the job/instance combination of the input labels and has the same labels values for other labels keys they have in common. If multiple targets satisfy this property, it is undefined which one is returned. This is generally a non-issue if the additional label keys are consistently set across all targets for the job/instance combination. If no target is found, nil is returned.

func (*Cache) Run

func (c *Cache) Run(ctx context.Context)

Run background refreshing of the cache.

type Target

type Target struct {
	Labels           labels.Labels `json:"labels"`
	DiscoveredLabels labels.Labels `json:"discoveredLabels"`
}

Jump to

Keyboard shortcuts

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