Documentation
¶
Overview ¶
Package pressure aggregates memory-pressure pprof profile metadata from all agents.
Index ¶
- type AggregatedPressureProfile
- type Aggregator
- func (a *Aggregator) CollectProfiles(ctx context.Context, filter *Filter) ([]*AggregatedPressureProfile, error)
- func (a *Aggregator) LookupForDownload(podName, profileID, profType string) (agentID, filepath, role string, ok bool)
- func (a *Aggregator) RemoveAgent(agentID string)
- func (a *Aggregator) ReplaceAgentProfiles(agentID string, agentInfo *registry.AgentInfo, ...)
- func (a *Aggregator) SetGRPCService(grpcService RequestSender)
- type Filter
- type ProfileInfo
- type RequestSender
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 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.