promclient

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 PromqlQueryInstant

func PromqlQueryInstant(ctx context.Context, logger log.Logger, base *url.URL, query string, t time.Time, dedup bool) (promql.Vector, 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, dedup bool) (model.Vector, 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.

Jump to

Keyboard shortcuts

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