metricshandler

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsHandler

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

MetricsHandler is a http.Handler that exposes the main kube-state-metrics /metrics endpoint. It allows concurrent reconfiguration at runtime.

func New

func New(opts *options.Options, kubeClient kubernetes.Interface, storeBuilder ksmtypes.BuilderInterface, enableGZIPEncoding bool) *MetricsHandler

New creates and returns a new MetricsHandler with the given options.

func (*MetricsHandler) BuildWriters added in v2.14.0

func (m *MetricsHandler) BuildWriters(ctx context.Context)

BuildWriters builds the metrics writers, cancelling any previous context and passing a new one on every build. Build can be used multiple times and concurrently.

func (*MetricsHandler) ConfigureSharding

func (m *MetricsHandler) ConfigureSharding(ctx context.Context, shard int32, totalShards int)

ConfigureSharding configures sharding. Configuration can be used multiple times and concurrently.

func (*MetricsHandler) Run

func (m *MetricsHandler) Run(ctx context.Context) error

Run configures the MetricsHandler's sharding and if autosharding is enabled re-configures sharding on re-sharding events. Run should only be called once.

func (*MetricsHandler) ServeHTTP

func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface. It writes all generated metrics to the response body. Note that all operations defined within this procedure are performed at every request.

Jump to

Keyboard shortcuts

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