Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultEndpointPath = "/api/v1/targets/metadata"
DefaultEndpointPath is the default HTTP path on which Prometheus serves the target metadata endpoint.
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 ¶
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) (*scrape.MetricMetadata, 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 the metadata cannot be found, nil is returned.
Click to show internal directories.
Click to hide internal directories.