pressure

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pressure aggregates memory-pressure pprof profile metadata from all agents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedPressureProfile

type AggregatedPressureProfile struct {
	CapturedAt       time.Time     `json:"captured_at"`
	AgentID          string        `json:"agent_id"`
	PodName          string        `json:"pod_name"`
	Role             string        `json:"role"`
	ProfileID        string        `json:"profile_id"`
	SourceEndpoint   string        `json:"source_endpoint"`
	Profiles         []ProfileInfo `json:"profiles"`
	RSSBytes         uint64        `json:"rss_bytes"`
	CgroupLimitBytes uint64        `json:"cgroup_limit_bytes"`
	ThresholdBytes   uint64        `json:"threshold_bytes"`
	TriggerPercent   uint32        `json:"trigger_percent"`
}

AggregatedPressureProfile enriches a capture event with the agent's identity.

type Aggregator

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

Aggregator keeps a dedup cache of capture-event metadata nested by agentID -> profileID. On each list request it pulls fresh metadata from every matching agent, waits a short window, then returns the cache snapshot. The authoritative copy lives on the agent disk.

func NewAggregator

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

NewAggregator creates a new Aggregator instance.

func (*Aggregator) CollectProfiles

func (a *Aggregator) CollectProfiles(ctx context.Context, filter *Filter) ([]*AggregatedPressureProfile, error)

CollectProfiles triggers a refresh from all matching agents, waits a short window for their metadata to arrive, then returns the current cache snapshot.

func (*Aggregator) LookupForDownload

func (a *Aggregator) LookupForDownload(podName, profileID, profType string) (agentID, filepath, role string, ok bool)

LookupForDownload resolves a download target: the agent currently online for podName (download routes by the stable pod name, not the volatile agent id), and the on-disk filepath of the requested profile from the cache.

func (*Aggregator) RemoveAgent

func (a *Aggregator) RemoveAgent(agentID string)

RemoveAgent drops all cached events for an agent (called on disconnect).

func (*Aggregator) ReplaceAgentProfiles

func (a *Aggregator) ReplaceAgentProfiles(agentID string, agentInfo *registry.AgentInfo, records []*fodcv1.PressureProfileRecord)

ReplaceAgentProfiles replaces an agent's whole cached set with the records of its just-completed list round, enriched with the agent's pod name and role. An empty round drops the agent's entry. Called on ListComplete with the records accumulated by the pressure stream handler for that round, so events the agent has evicted from its disk drop out instead of lingering as unservable entries.

func (*Aggregator) SetGRPCService

func (a *Aggregator) SetGRPCService(grpcService RequestSender)

SetGRPCService sets the gRPC service used to request profiles from agents.

type Filter

type Filter struct {
	Role    string
	PodName string
}

Filter narrows the listed/collected profiles by role and pod name.

type ProfileInfo

type ProfileInfo struct {
	Type      string `json:"type"`
	Filename  string `json:"filename"`
	Filepath  string `json:"filepath"`
	Format    string `json:"format"`
	SizeBytes int64  `json:"size_bytes"`
}

ProfileInfo is one pprof profile's metadata in the HTTP list response.

type RequestSender

type RequestSender interface {
	CollectList(agentIDs []string) <-chan struct{}
}

RequestSender drives the agents to stream their profile metadata. CollectList sends a list command to every given agent under one request and returns a channel closed once all of them have signaled completion.

Jump to

Keyboard shortcuts

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