prometheus

package
v1.12.0-community Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRoundTripper

func CreateRoundTripper(timeout time.Duration, skipTLS bool, caPath string, forwardUserToken bool, tokenPath string, requestHeader http.Header) (http.RoundTripper, error)

func FiltersToLabels

func FiltersToLabels(filts filters.SingleQuery) ([]string, string)

FiltersToLabels converts filters to labels (extracting keys) and direction, checking for any unsupported filters. If unsupported, returns a reason as the second value

func GetLabelValues

func GetLabelValues(ctx context.Context, cl api.Client, label string, match []string) ([]string, int, error)

func GetLabelsAndFilter

func GetLabelsAndFilter(kl map[string][]string, aggregate, groups string) ([]string, string)

GetLabelsAndFilter returns the label fields for grouping and an optional extra filter string. For Prometheus, the "app" aggregate is a noop (it's only relevant for Loki stream selectors).

func NewAdminClient

func NewAdminClient(cfg *config.Prometheus, requestHeader http.Header) (api.Client, error)

func NewDevClient

func NewDevClient(cfg *config.Prometheus, requestHeader http.Header, namespace string) (api.Client, error)

func QueryFilters

func QueryFilters(metric string, filters filters.SingleQuery) string

QueryFilters builds a PromQL metric selector string with the given filters applied.

func QueryMatrix

func QueryMatrix(ctx context.Context, cl api.Client, q *Query) (model.QueryResponse, int, error)

Types

type Inventory

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

func NewInventory

func NewInventory(cfg *config.Prometheus) *Inventory

func (*Inventory) LabelExists

func (i *Inventory) LabelExists(label string) bool

func (*Inventory) Search

func (i *Inventory) Search(neededLabels []string, valueField string) SearchResult

type Query

type Query struct {
	Range  v1.Range
	PromQL string
}

type QueryBuilder

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

func NewQuery

func NewQuery(kl map[string][]string, in *queryparams.TopologyInput, qr *v1.Range, filters filters.SingleQuery, orMetrics []string) *QueryBuilder

NewQuery creates a new PromQL QueryBuilder for the given topology input.

func (*QueryBuilder) Build

func (q *QueryBuilder) Build() Query

type SearchResult

type SearchResult struct {
	Found         []string // Multiple metrics in case we need to run <ingress metric> OR <egress metric>
	Candidates    []string
	MissingLabels map[string][]string
}

Jump to

Keyboard shortcuts

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