metrics

package
v0.14.0-rc.21 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package metrics holds the adapters that query a metrics backing service (an installed or connected add-on) for the agent's metrics-query path (ADR-0026).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PromQL

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

PromQL queries a Prometheus-HTTP-API-compatible metrics store over its instant-query API. Burrow connects to an existing store the user already runs and queries it — it never distributes the store (ADR-0026). Prometheus and VictoriaMetrics share the same /api/v1/query API, so this one adapter serves both. The store's in-cluster endpoint (host:port) is passed per query, along with an optional bearer token for an authenticated store.

func NewPromQL

func NewPromQL(hc *http.Client) PromQL

NewPromQL returns a PromQL querier using hc (defaulting to http.DefaultClient).

func (PromQL) QueryMetrics

func (p PromQL) QueryMetrics(ctx context.Context, endpoint, query, token string) ([]controlplane.MetricSample, error)

QueryMetrics runs an instant PromQL query against the store at endpoint and returns the matching samples. A non-empty token is sent as an Authorization: Bearer header for an authenticated store. A vector result yields one MetricSample per series (labels from metric, value and timestamp from the value pair); a scalar result yields a single MetricSample with no labels.

func (PromQL) QueryMetricsRange

func (p PromQL) QueryMetricsRange(ctx context.Context, endpoint, query, token string, start, end time.Time, step time.Duration) ([]controlplane.MetricSeries, error)

QueryMetricsRange runs a PromQL range query against the store at endpoint over [start, end] sampled every step and returns one MetricSeries per matching series. A non-empty token is sent as an Authorization: Bearer header for an authenticated store. start and end are encoded as unix seconds (the same numeric timestamp encoding decodeValuePair reads back), and step as a float number of seconds — both forms the Prometheus /api/v1/query_range API accepts. A range query returns a matrix; each series' points carry the labels from metric and the value/timestamp of each sampled step.

Jump to

Keyboard shortcuts

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