monitor

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StreamCache = NewCache()

single instance of the pepr stream cache

Functions

func BindClusterOverviewHandler

func BindClusterOverviewHandler(cache *resources.Cache) func(w http.ResponseWriter, r *http.Request)

func Pepr

func Pepr(k8sCtx string) func(w http.ResponseWriter, r *http.Request)

@Description Get Pepr data @Tags monitor @Accept html @Produce text/event-stream @Success 200 @Router /monitor/pepr/{stream} [get] @Param stream path string false "stream type to filter on, all streams by default" Enums(AnyStream, PolicyStream, OperatorStream, AllowStream, DenyStream, MutateStream, FailureStream)

Types

type Cache

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

Cache is a simple cache for pepr stream data, it can be invalidated by a timer and max size

func NewCache

func NewCache() *Cache

NewCache creates a new cache for pepr stream data

func (*Cache) Get

func (c *Cache) Get() *bytes.Buffer

Get returns a deep copy of cached buffer

func (*Cache) Reset

func (c *Cache) Reset()

Reset resets the cache

func (*Cache) Serve

func (c *Cache) Serve(w http.ResponseWriter)

Serve attempts to serve a cached response if available.

func (*Cache) Set

func (c *Cache) Set(buffer *bytes.Buffer)

Set sets the cached buffer

func (*Cache) Stop

func (c *Cache) Stop()

Stop stops the cache timer

type ClusterOverviewData added in v0.9.0

type ClusterOverviewData struct {
	TotalPods       int                      `json:"totalPods"`
	TotalNodes      int                      `json:"totalNodes"`
	CPUCapacity     float64                  `json:"cpuCapacity"`
	MemoryCapacity  float64                  `json:"memoryCapacity"`
	CurrentUsage    resources.Usage          `json:"currentUsage"`
	HistoricalUsage []resources.Usage        `json:"historicalUsage"`
	PackagesData    []map[string]interface{} `json:"packagesData"`
	PodsData        []map[string]interface{} `json:"podsData"`
}

Jump to

Keyboard shortcuts

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