remotemetrics

package
v0.10.2 Latest Latest
Warning

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

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

Documentation

Overview

Package remotemetrics contains the logic to scrape and parse metrics from a remote cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHTTPHandler

func GetHTTPHandler(restClient rest.Interface, cl client.Client) (http.Handler, error)

GetHTTPHandler returns a handler for the metrics API.

Types

type Aggregator

type Aggregator interface {
	Aggregate(metric Metrics) Metrics
}

Aggregator is the interface for a metrics aggregator.

type MappedNamespace

type MappedNamespace struct {
	Namespace    string
	OriginalName string
}

MappedNamespace contains both the original and the mapped namespace names.

type Mapper

type Mapper interface {
	Map(line string) string
}

Mapper is the interface for a mapper.

func NewNamespaceMapper

func NewNamespaceMapper(namespaces ...MappedNamespace) Mapper

NewNamespaceMapper returns a new namespace mapper.

type Matcher

type Matcher interface {
	Match(line string) bool
}

Matcher is the interface for a matcher.

func MatchNamespaces

func MatchNamespaces(namespaces ...MappedNamespace) Matcher

MatchNamespaces returns a matcher that matches the given namespaces.

func MatchPods

func MatchPods(pods ...string) Matcher

MatchPods returns a matcher that matches the given pods.

type MatcherCollection

type MatcherCollection interface {
	Matcher
	Add(matcher Matcher) MatcherCollection
}

MatcherCollection is the interface for a matcher collection.

func MatchAll

func MatchAll() MatcherCollection

MatchAll returns a matcher that matches all the given matchers.

func MatchAny

func MatchAny() MatcherCollection

MatchAny returns a matcher that matches any of the given matchers.

func MatchNodeMetrics

func MatchNodeMetrics() MatcherCollection

MatchNodeMetrics returns a matcher that matches the node metrics.

type Metric

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

Metric contains the scraped prometheus metrics.

type Metrics

type Metrics []*Metric

Metrics is the alias for a list of metrics.

func (Metrics) Write

func (m Metrics) Write(w io.Writer)

Write writes the metrics to the given writer.

type ResourceGetter

type ResourceGetter interface {
	GetNamespaces(ctx context.Context, clusterID string) []MappedNamespace
	GetPodNames(ctx context.Context, clusterID, node string) []string
	GetNodeNames(ctx context.Context) []string
}

ResourceGetter is the interface for a local resource getter.

func NewResourceGetter

func NewResourceGetter(cl client.Client) ResourceGetter

NewResourceGetter creates a new resource getter.

type Scraper

type Scraper interface {
	Scrape(ctx context.Context, path, clusterID string) (Metrics, error)
}

Scraper is the interface for a remote metrics scraper.

func NewAPIServiceScraper

func NewAPIServiceScraper(restClient rest.Interface, cl client.Client) Scraper

NewAPIServiceScraper creates a new scraper that scrapes metrics from the API server.

Jump to

Keyboard shortcuts

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