metadata

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache populates and maintains a cache of metric metadata it retrieves from a given Prometheus server. Its methods are not safe for concurrent use.

func NewCache

func NewCache(client *http.Client, targetMetadataURL *url.URL, metadataURL *url.URL, staticMetadata []*config.MetadataEntry) *Cache

NewCache returns a new cache that gets populated by the metadata endpoint at the given URL. It uses the default endpoint path if no specific path is provided.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, job, instance, metric string) (*config.MetadataEntry, error)

Get returns metadata for the given metric and job. If the metadata is not in the cache, it blocks until we have retrieved it from the Prometheus server. If no metadata is found in the Prometheus server, a matching entry from the static metadata or nil is returned.

Jump to

Keyboard shortcuts

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