Documentation
¶
Overview ¶
Package metrics provides functionality for aggregating and enriching metrics from all agents.
Index ¶
- type AggregatedMetric
- type Aggregator
- func (ma *Aggregator) ActiveCollections() int
- func (ma *Aggregator) CollectMetricsFromAgents(ctx context.Context, filter *Filter) ([]*AggregatedMetric, error)
- func (ma *Aggregator) GetLatestMetrics(ctx context.Context, filter *Filter) ([]*AggregatedMetric, error)
- func (ma *Aggregator) GetMetricsWindow(ctx context.Context, startTime, endTime time.Time, filter *Filter) ([]*AggregatedMetric, error)
- func (ma *Aggregator) ProcessMetricsFromAgent(ctx context.Context, agentID string, agentInfo *registry.AgentInfo, ...) error
- func (ma *Aggregator) SetGRPCService(grpcService RequestSender)
- type Filter
- type RequestSender
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.