Documentation
¶
Overview ¶
Package prometheus builds the MetricsQuerier from config: the zero-infrastructure stub (the default) or the HTTP query API, its requests run through the client tier. The concrete backends live in the stub/ and http/ subpackages.
Index ¶
Constants ¶
View Source
const ( // KindStub answers every query with a zero (the default). KindStub = client.KindStub // KindHTTP queries a Prometheus server's HTTP API. KindHTTP client.Kind = "http" )
View Source
const DefaultMaxBodyBytes int64 = 32 << 20
DefaultMaxBodyBytes is DefaultConfig's response-body cap (32 MiB).
Variables ¶
This section is empty.
Functions ¶
func NewFromConfig ¶
func NewFromConfig( ctx context.Context, cfg Config, deps Deps, ) (interfaces.MetricsQuerier, error)
NewFromConfig builds the querier cfg.Kind selects, without I/O. An unknown kind, or KindHTTP without a base URL, is CodeInvalidInput.
Types ¶
type Config ¶
type Config struct {
// Kind selects the backend; empty means KindStub.
Kind client.Kind `yaml:"kind" mapstructure:"kind"`
// Name labels the client in decoration overrides, metrics, spans and logs; empty
// uses the family name ("prometheus").
Name string `yaml:"name" mapstructure:"name"`
// HTTP configures KindHTTP.
HTTP promhttp.Config `yaml:"http" mapstructure:"http"`
}
Config selects and configures the metrics querier.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the stub kind, a 30-second request timeout and a 32 MiB body cap.
type Deps ¶ added in v0.0.7
type Deps struct {
// Decorations decorates the client from the decoration config (decoration.clients)
// and supplies its observability.
decorate.Decorations
// Doer replaces the http.Client KindHTTP builds from Config.HTTP.Timeout.
Doer promhttp.HTTPDoer
}
Deps carries the querier's runtime collaborators.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package http is the HTTP backend of the Prometheus querier: instant queries reduced to one sample, and range queries reduced to one series, over a Prometheus server's HTTP query API.
|
Package http is the HTTP backend of the Prometheus querier: instant queries reduced to one sample, and range queries reduced to one series, over a Prometheus server's HTTP query API. |
|
Package stub is the zero-infrastructure metrics querier: every instant query is 0 and every range query an empty series, with no network I/O.
|
Package stub is the zero-infrastructure metrics querier: every instant query is 0 and every range query an empty series, with no network I/O. |
Click to show internal directories.
Click to hide internal directories.