metrics

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package metrics provides functionality for aggregating and enriching metrics from all agents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedMetric

type AggregatedMetric struct {
	Labels      map[string]string
	Timestamp   time.Time
	Name        string
	AgentID     string
	Description string
	Value       float64
}

AggregatedMetric represents an aggregated metric with node metadata.

type Aggregator

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

Aggregator aggregates and enriches metrics from all agents.

func NewAggregator

func NewAggregator(registry *registry.AgentRegistry, grpcService RequestSender, logger *logger.Logger) *Aggregator

NewAggregator creates a new MetricsAggregator instance.

func (*Aggregator) ActiveCollections

func (ma *Aggregator) ActiveCollections() int

ActiveCollections returns the number of agents currently being collected.

func (*Aggregator) CollectMetricsFromAgents

func (ma *Aggregator) CollectMetricsFromAgents(ctx context.Context, filter *Filter) ([]*AggregatedMetric, error)

CollectMetricsFromAgents requests metrics from all agents (or filtered agents) when external client queries.

func (*Aggregator) GetLatestMetrics

func (ma *Aggregator) GetLatestMetrics(ctx context.Context, filter *Filter) ([]*AggregatedMetric, error)

GetLatestMetrics triggers on-demand collection from all agents.

func (*Aggregator) GetMetricsWindow

func (ma *Aggregator) GetMetricsWindow(ctx context.Context, startTime, endTime time.Time, filter *Filter) ([]*AggregatedMetric, error)

GetMetricsWindow triggers on-demand collection from all agents with time window filter.

func (*Aggregator) ProcessMetricsFromAgent

func (ma *Aggregator) ProcessMetricsFromAgent(ctx context.Context, agentID string, agentInfo *registry.AgentInfo, req *fodcv1.StreamMetricsRequest) error

ProcessMetricsFromAgent processes metrics received from an agent.

func (*Aggregator) SetGRPCService

func (ma *Aggregator) SetGRPCService(grpcService RequestSender)

SetGRPCService sets the gRPC service for sending metrics requests.

type Filter

type Filter struct {
	StartTime *time.Time
	EndTime   *time.Time
	Role      string
	PodName   string
	AgentIDs  []string
}

Filter defines filters for metrics collection.

type RequestSender

type RequestSender interface {
	RequestMetrics(agentID string, startTime, endTime *time.Time) error
}

RequestSender is an interface for sending metrics requests to agents.

Jump to

Keyboard shortcuts

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