Version: v2.5.0+incompatible Latest Latest

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

Go to latest
Published: Nov 6, 2018 License: Apache-2.0 Imports: 34 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type API

type API struct {
	Queryable   storage.Queryable
	QueryEngine *promql.Engine
	// contains filtered or unexported fields

API can register a set of endpoints in a router and handle them using the provided storage and query engine.

func NewAPI

func NewAPI(
	qe *promql.Engine,
	q storage.Queryable,
	tr targetRetriever,
	ar alertmanagerRetriever,
	configFunc func() config.Config,
	flagsMap map[string]string,
	readyFunc func(http.HandlerFunc) http.HandlerFunc,
	db func() *tsdb.DB,
	enableAdmin bool,
	logger log.Logger,
	rr rulesRetriever,
	remoteReadSampleLimit int,
	remoteReadConcurrencyLimit int,
) *API

NewAPI returns an initialized API type.

func (*API) Register

func (api *API) Register(r *route.Router)

Register the API's endpoints in the given router.

type Alert

type Alert struct {
	Labels      labels.Labels `json:"labels"`
	Annotations labels.Labels `json:"annotations"`
	State       string        `json:"state"`
	ActiveAt    *time.Time    `json:"activeAt,omitempty"`
	Value       float64       `json:"value"`

Alert has info for an alert.

type AlertDiscovery

type AlertDiscovery struct {
	Alerts []*Alert `json:"alerts"`

AlertDiscovery has info for all active alerts.

type AlertmanagerDiscovery added in v1.5.0

type AlertmanagerDiscovery struct {
	ActiveAlertmanagers  []*AlertmanagerTarget `json:"activeAlertmanagers"`
	DroppedAlertmanagers []*AlertmanagerTarget `json:"droppedAlertmanagers"`

AlertmanagerDiscovery has all the active Alertmanagers.

type AlertmanagerTarget added in v1.5.0

type AlertmanagerTarget struct {
	URL string `json:"url"`

AlertmanagerTarget has info on one AM.

type DroppedTarget

type DroppedTarget struct {
	// Labels before any processing.
	DiscoveredLabels map[string]string `json:"discoveredLabels"`

DroppedTarget has the information for one target that was dropped during relabelling.

type RuleDiscovery

type RuleDiscovery struct {
	RuleGroups []*RuleGroup `json:"groups"`

RuleDiscovery has info for all rules

type RuleGroup

type RuleGroup struct {
	Name string `json:"name"`
	File string `json:"file"`
	// In order to preserve rule ordering, while exposing type (alerting or recording)
	// specific properties, both alerting and recording rules are exposed in the
	// same array.
	Rules    []rule  `json:"rules"`
	Interval float64 `json:"interval"`

RuleGroup has info for rules which are part of a group

type Target added in v1.5.0

type Target struct {
	// Labels before any processing.
	DiscoveredLabels map[string]string `json:"discoveredLabels"`
	// Any labels that are added to this target and its metrics.
	Labels map[string]string `json:"labels"`

	ScrapeURL string `json:"scrapeUrl"`

	LastError  string              `json:"lastError"`
	LastScrape time.Time           `json:"lastScrape"`
	Health     scrape.TargetHealth `json:"health"`

Target has the information for one target.

type TargetDiscovery added in v1.5.0

type TargetDiscovery struct {
	ActiveTargets  []*Target        `json:"activeTargets"`
	DroppedTargets []*DroppedTarget `json:"droppedTargets"`

TargetDiscovery has all the active targets.

Source Files

Jump to

Keyboard shortcuts

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