diagnostics

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: 8 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 diagnostics provides functionality for aggregating crash/panic diagnostic data from all agents.

Index

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 Filter

type Filter struct {
	Role    string
	PodName string
}

Filter defines filters for diagnostics collection.

type RequestSender

type RequestSender interface {
	RequestDiagnostics(agentID string) error
}

RequestSender is an interface for requesting crash diagnostics from agents.

Jump to

Keyboard shortcuts

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