Documentation
¶
Overview ¶
Package diagnostics provides functionality for aggregating crash/panic diagnostic data from all agents.
Index ¶
- type AggregatedCrashRecord
- type Aggregator
- func (a *Aggregator) CollectDiagnostics(ctx context.Context, filter *Filter) ([]*AggregatedCrashRecord, error)
- func (a *Aggregator) ProcessCrashFromAgent(agentID string, agentInfo *registry.AgentInfo, ...)
- func (a *Aggregator) RemoveAgent(agentID string)
- func (a *Aggregator) SetGRPCService(grpcService RequestSender)
- type CrashBreadcrumbInfo
- type CrashPanicInfo
- type Filter
- type RequestSender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedCrashRecord ¶
type AggregatedCrashRecord struct {
FetchedAt time.Time `json:"fetched_at"`
PanicRecord *CrashPanicInfo `json:"panic_record,omitempty"`
AgentID string `json:"agent_id"`
PodName string `json:"pod_name"`
Role string `json:"role"`
SourceEndpoint string `json:"source_endpoint"`
ArtifactDir string `json:"artifact_dir"`
Files []string `json:"files,omitempty"`
}
AggregatedCrashRecord enriches a crash collection with agent identity.
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator aggregates crash diagnostic data from all agents.
Unlike the metrics aggregator (which uses a request/response channel per collection cycle), crash records arrive as one gRPC message per record with no end-of-batch signal in the current proto. The aggregator therefore keeps a dedup cache keyed by "agentID::artifactDir". On each HTTP request it triggers a fresh pull from every agent, waits a short window for messages to arrive, then returns the current cache snapshot.
func NewAggregator ¶
func NewAggregator(registry *registry.AgentRegistry, grpcService RequestSender, log *logger.Logger) *Aggregator
NewAggregator creates a new Aggregator instance.
func (*Aggregator) CollectDiagnostics ¶
func (a *Aggregator) CollectDiagnostics(ctx context.Context, filter *Filter) ([]*AggregatedCrashRecord, error)
CollectDiagnostics triggers a refresh from all matching agents, waits a short window for their records to arrive, then returns the current cache snapshot.
func (*Aggregator) ProcessCrashFromAgent ¶
func (a *Aggregator) ProcessCrashFromAgent(agentID string, agentInfo *registry.AgentInfo, req *fodcv1.StreamCrashDiagnosticsRequest)
ProcessCrashFromAgent stores or updates the cached record for this crash artifact. Each StreamCrashDiagnosticsRequest carries exactly one artifact; dedup is by artifactDir.
func (*Aggregator) RemoveAgent ¶
func (a *Aggregator) RemoveAgent(agentID string)
RemoveAgent removes all cached records for an agent (called on disconnect).
func (*Aggregator) SetGRPCService ¶
func (a *Aggregator) SetGRPCService(grpcService RequestSender)
SetGRPCService sets the gRPC service for sending diagnostics requests.
type CrashBreadcrumbInfo ¶
type CrashBreadcrumbInfo struct {
OccurredAt time.Time `json:"occurred_at"`
Fields map[string]string `json:"fields,omitempty"`
Stage string `json:"stage"`
Component string `json:"component,omitempty"`
}
CrashBreadcrumbInfo holds one panic breadcrumb from a crash record.
type CrashPanicInfo ¶
type CrashPanicInfo struct {
Component string `json:"component"`
GoroutineStack string `json:"goroutine_stack,omitempty"`
PanicValue string `json:"panic_value"`
OccurredAt time.Time `json:"occurred_at"`
ProcessMetadata map[string]string `json:"process_metadata,omitempty"`
Breadcrumbs []CrashBreadcrumbInfo `json:"breadcrumbs,omitempty"`
Recovered bool `json:"recovered"`
}
CrashPanicInfo holds the panic details from a crash record.
type RequestSender ¶
RequestSender is an interface for requesting crash diagnostics from agents.