pkg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ActiveTargets  []VMAgentAPITarget `json:"activeTargets"`
	DroppedTargets []VMAgentAPITarget `json:"droppedTargets"`
}

type EnvDiscovery

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

EnvDiscovery returns vmagent endpoints defined in the environment.

func NewEnvDiscovery

func NewEnvDiscovery(envvar string) *EnvDiscovery

NewEnvDiscovery will return a new EnvDiscovery instance which will look up vmagent endpoints from the provided env var.

func (*EnvDiscovery) DiscoverEndpoints

func (e *EnvDiscovery) DiscoverEndpoints() ([]string, error)

DiscoverEndpoints returns a string slice for endpoints from the EnvDiscovery configured env var Because env vars cannot change post-process-start, an empty env var will return an error

type FileDiscovery

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

FileDiscovery returns vmagent endpoints based on file contents

func NewFileDiscovery

func NewFileDiscovery(fp string) *FileDiscovery

func (*FileDiscovery) DiscoverEndpoints

func (f *FileDiscovery) DiscoverEndpoints() ([]string, error)

DiscoverEndpoints returns a slice of strings hopefully containing vmagent endpoints, from the FileDiscovery's configured file.

type StaticMemDiscovery

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

func (*StaticMemDiscovery) DiscoverEndpoints

func (s *StaticMemDiscovery) DiscoverEndpoints() ([]string, error)

type VMAgentAPICollection

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

func NewVMAgentCollection

func NewVMAgentCollection(discovery VMAgentDiscoverer) (*VMAgentAPICollection, error)

NewVMAgentCollection initializes a new VMAgentAPICollection, used to hold data from multiple vmagent APIs

func (*VMAgentAPICollection) CollectAll

func (v *VMAgentAPICollection) CollectAll() []error

func (*VMAgentAPICollection) Data

func (*VMAgentAPICollection) Reconcile

func (v *VMAgentAPICollection) Reconcile(newEndpoints []string) error

Reconcile accepts a list of new endpoints a VMAgentAPICollection should track. New entries are added to the collection, while endpoints in the VMAgentAPICollection but not in the new list are removed

type VMAgentAPICollectionError

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

func (VMAgentAPICollectionError) Error

func (VMAgentAPICollectionError) Unwrap

func (e VMAgentAPICollectionError) Unwrap() error

type VMAgentAPICollector

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

func NewVMAgentAPICollector

func NewVMAgentAPICollector(s string, c *http.Client) (*VMAgentAPICollector, error)

NewVMAgentAPICollector returns a collector for a vmagent API endpoint. It is expected that the full URL to the vmagent targets API is provided

func (*VMAgentAPICollector) Collect

Collect returns a vmagent API response

type VMAgentAPIResponse

type VMAgentAPIResponse struct {
	Data   Data   `json:"data"`
	Status string `json:"status"`
}

type VMAgentAPITarget

type VMAgentAPITarget struct {
	DiscoveredLabels   map[string]string `json:"discoveredLabels"`
	Labels             map[string]string `json:"labels"`
	ScrapePool         string            `json:"scrapePool"`
	ScrapeURL          string            `json:"scrapeUrl"`
	LastError          string            `json:"lastError"`
	LastScrape         time.Time         `json:"lastScrape"`
	LastScrapeDuration float64           `json:"lastScrapeDuration"`
	LastSamplesScraped int               `json:"lastSamplesScraped"`
	Health             string            `json:"health"`
}

type VMAgentDiscoverer

type VMAgentDiscoverer interface {
	DiscoverEndpoints() ([]string, error)
}

Jump to

Keyboard shortcuts

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