Documentation
¶
Overview ¶
Package observe connects a run to the target's own telemetry: it queries Prometheus for the target's metrics over the run, for the report.
Index ¶
Constants ¶
const MaxPoints = 10_000
MaxPoints bounds the points per query. Prometheus refuses ranges of more than 11,000 points per series, so long runs use a coarser step.
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect(ctx context.Context, p *Prometheus, queries []Query, start, end time.Time, interval time.Duration) []report.TargetMetric
Collect evaluates each query over [start, end] and returns them as report target metrics, with times relative to start. A query that fails is returned with its error rather than failing the others.
Types ¶
type Config ¶
type Config struct {
// Prometheus is nil when no metrics are queried.
Prometheus *Prometheus
Queries []Query
// TraceURL is a link template containing {traceId}; empty for none.
TraceURL string
}
Config is an observe block with its URLs and credentials resolved: from the scenario for stampede run, from named integrations on the server.
type Prometheus ¶
type Prometheus struct {
// URL is the base URL, for example http://prometheus:9090. A path
// prefix (https://host/prometheus) is kept.
URL string
// BearerToken, when set, is sent as Authorization: Bearer.
BearerToken string
// Client defaults to a client with a 30 second timeout.
Client *http.Client
}
Prometheus is a client for the Prometheus HTTP API (and compatible servers such as Thanos, Mimir and VictoriaMetrics).