promclient

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFlagEndpointNotFound = errors.New("no flag endpoint found")

Functions

func ExternalLabels

func ExternalLabels(ctx context.Context, logger log.Logger, base *url.URL) (labels.Labels, error)

ExternalLabels returns external labels from /api/v1/status/config Prometheus endpoint. Note that configuration can be hot reloadable on Prometheus, so this config might change in runtime.

func IsWALDirAccesible

func IsWALDirAccesible(dir string) error

IsWALFileAccesible returns no error if WAL dir can be found. This helps to tell if we have access to Prometheus TSDB directory.

func MetricValues added in v0.4.0

func MetricValues(ctx context.Context, logger log.Logger, base *url.URL, perMetricFn func(metric promlabels.Labels, val float64) error) error

MetricValues returns current value of instant query and returns results in model.Vector type.

func PromqlQueryInstant

func PromqlQueryInstant(ctx context.Context, logger log.Logger, base *url.URL, query string, t time.Time, opts QueryOptions) (promql.Vector, []string, error)

PromqlQueryInstant performs instant query and returns results in promql.Vector type that is compatible with promql package.

func QueryInstant

func QueryInstant(ctx context.Context, logger log.Logger, base *url.URL, query string, t time.Time, opts QueryOptions) (model.Vector, []string, error)

QueryInstant performs instant query and returns results in model.Vector type.

func Snapshot

func Snapshot(ctx context.Context, logger log.Logger, base *url.URL, skipHead bool) (string, error)

Snapshot will request Prometheus to perform snapshot in directory returned by this function. Returned directory is relative to Prometheus data-dir. NOTE: `--web.enable-admin-api` flag has to be set on Prometheus. Added to Prometheus from v2.1. TODO(bwplotka): Add metrics.

Types

type Flags

type Flags struct {
	TSDBPath           string         `json:"storage.tsdb.path"`
	TSDBRetention      model.Duration `json:"storage.tsdb.retention"`
	TSDBMinTime        model.Duration `json:"storage.tsdb.min-block-duration"`
	TSDBMaxTime        model.Duration `json:"storage.tsdb.max-block-duration"`
	WebEnableAdminAPI  bool           `json:"web.enable-admin-api"`
	WebEnableLifecycle bool           `json:"web.enable-lifecycle"`
}

func ConfiguredFlags

func ConfiguredFlags(ctx context.Context, logger log.Logger, base *url.URL) (Flags, error)

ConfiguredFlags returns configured flags from /api/v1/status/flags Prometheus endpoint. Added to Prometheus from v2.2.

func (*Flags) UnmarshalJSON

func (f *Flags) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type QueryOptions added in v0.4.0

type QueryOptions struct {
	Deduplicate             bool
	PartialResponseStrategy storepb.PartialResponseStrategy
}

func (*QueryOptions) AddTo added in v0.4.0

func (p *QueryOptions) AddTo(values url.Values) error

Jump to

Keyboard shortcuts

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