server

package
v0.0.70 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSubscription

type ClientSubscription struct {
	ID        string
	Channel   chan *gen.MpaStreamResponse
	Interests []WorkloadInterest
}

type MpaServer

type MpaServer struct {
	gen.UnimplementedMpaServiceServer
	// contains filtered or unexported fields
}

MpaServer implements the gRPC service for in-cluster MPA metric streaming

func NewMpaServer

func NewMpaServer(logger logr.Logger, historicalCollector *collector.HistoricalMetricsCollector, healthManager *health.HealthManager) *MpaServer

NewMpaServer creates a new MpaServer. historicalCollector may be nil if Prometheus is not available.

func (*MpaServer) PublishMetrics

func (s *MpaServer) PublishMetrics(metrics *collector.ContainerMetricsSnapshot, timestamp time.Time)

PublishMetrics is called by the collector to broadcast new metrics

func (*MpaServer) Start

func (s *MpaServer) Start(port int) error

Start starts the gRPC server on the given port

func (*MpaServer) Stop

func (s *MpaServer) Stop()

Stop gracefully stops the gRPC server

func (*MpaServer) StreamWorkloadMetrics

func (s *MpaServer) StreamWorkloadMetrics(stream gen.MpaService_StreamWorkloadMetricsServer) error

type SubscriptionManager

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

SubscriptionManager manages active streams and their interests

func NewSubscriptionManager

func NewSubscriptionManager(logger logr.Logger) *SubscriptionManager

func (*SubscriptionManager) Broadcast

func (sm *SubscriptionManager) Broadcast(data *collector.ContainerMetricsSnapshot, timestamp time.Time)

Broadcast filters and dispatches metrics to interested clients

func (*SubscriptionManager) GetInterests added in v0.0.61

func (sm *SubscriptionManager) GetInterests(clientID string) []WorkloadInterest

GetInterests returns the current interests for a client.

func (*SubscriptionManager) Register

func (sm *SubscriptionManager) Register(ch chan *gen.MpaStreamResponse) string

func (*SubscriptionManager) Unregister

func (sm *SubscriptionManager) Unregister(id string)

func (*SubscriptionManager) UpdateSubscription

func (sm *SubscriptionManager) UpdateSubscription(clientID string, sub *gen.MpaWorkloadSubscription)

type WorkloadInterest

type WorkloadInterest struct {
	Namespace string
	Name      string
	Kind      string
	Selector  map[string]string
}

Jump to

Keyboard shortcuts

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