clusterinfo

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConsumerAlreadyRegistered is returned if a consumer is already registered
	ErrConsumerAlreadyRegistered = errors.New("consumer already registered")
	// ErrInitialCallTimeout is returned if the initial clusterinfo call timed out
	ErrInitialCallTimeout = errors.New("initial cluster info call timed out")
)

Functions

This section is empty.

Types

type Response

type Response struct {
	Name        string      `json:"name"`
	ClusterName string      `json:"cluster_name"`
	ClusterUUID string      `json:"cluster_uuid"`
	Version     VersionInfo `json:"version"`
	Tagline     string      `json:"tagline"`
}

Response is the cluster info retrievable from the / endpoint

type Retriever

type Retriever struct {
	// contains filtered or unexported fields
}

Retriever periodically gets the cluster info from the / endpoint end sends it to all registered consumer channels

func New

func New(logger log.Logger, client *http.Client, u *url.URL, interval time.Duration) *Retriever

New creates a new Retriever

func (*Retriever) Collect

func (r *Retriever) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface

func (*Retriever) Describe

func (r *Retriever) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface

func (*Retriever) RegisterConsumer

func (r *Retriever) RegisterConsumer(c consumer) error

RegisterConsumer registers a consumer for cluster info updates

func (*Retriever) Run

func (r *Retriever) Run(ctx context.Context) error

Run starts the update loop and periodically queries the / endpoint The update loop is terminated upon ctx cancellation. The call blocks until the first call to the cluster info endpoint was successful

func (*Retriever) Update

func (r *Retriever) Update()

Update triggers an external cluster info label update

type VersionInfo

type VersionInfo struct {
	Number        semver.Version `json:"number"`
	BuildHash     string         `json:"build_hash"`
	BuildDate     string         `json:"build_date"`
	BuildSnapshot bool           `json:"build_snapshot"`
	LuceneVersion semver.Version `json:"lucene_version"`
}

VersionInfo is the version info retrievable from the / endpoint, embedded in Response

Jump to

Keyboard shortcuts

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