diagnostics

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package diagnostics collects content-free evidence about a HAPTIC fleet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBundle

func WriteBundle(path string, report *Report) (result error)

WriteBundle creates a private, exclusive archive from the same allowlisted report.

func WriteJSON

func WriteJSON(writer io.Writer, report *Report) error

func WriteText

func WriteText(writer io.Writer, report *Report) error

Types

type Agent

type Agent struct {
	Pod
	Observed                  bool   `json:"observed"`
	ProtocolVersion           int    `json:"protocol_version"`
	PlanSchemaVersion         int    `json:"plan_schema_version"`
	AgentVersion              string `json:"agent_version,omitempty"`
	HAProxyVersion            string `json:"haproxy_version,omitempty"`
	WorkerRunning             bool   `json:"worker_running"`
	WorkerPID                 int    `json:"worker_pid"`
	WorkerStartTimeUnixMicros int64  `json:"worker_start_time_unix_micros"`
	WorkerGeneration          uint64 `json:"worker_generation"`
	AppliedPlanID             string `json:"applied_plan_id,omitempty"`
	RunningPlanID             string `json:"running_plan_id,omitempty"`
	WorkerOpsPlanID           string `json:"worker_ops_plan_id,omitempty"`
	ConfigFileDigest          string `json:"config_file_digest,omitempty"`
	FileCount                 int    `json:"file_count"`
	ReloadFallback            bool   `json:"reload_fallback"`
	LastApplyFailed           bool   `json:"last_apply_failed"`
	InvariantFailed           bool   `json:"invariant_failed"`
}

type Collector

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

func New

func New(options *Options, client kubernetes.Interface, dyn dynamic.Interface, access func(int) PodAccess) (*Collector, error)

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context) *Report

type Condition

type Condition struct {
	Path               string    `json:"path"`
	Type               string    `json:"type"`
	Status             string    `json:"status"`
	Reason             string    `json:"reason,omitempty"`
	ObservedGeneration int64     `json:"observed_generation,omitempty"`
	LastTransitionTime time.Time `json:"last_transition_time,omitzero"`
}

type Configuration

type Configuration struct {
	Resource
	ValidationStatus   string          `json:"validation_status,omitempty"`
	ValidationErrors   int             `json:"validation_error_count"`
	ObservedGeneration int64           `json:"observed_generation,omitempty"`
	DesiredChecksum    string          `json:"desired_checksum,omitempty"`
	Deployments        []PodDeployment `json:"deployments,omitempty"`
}

type Container

type Container struct {
	Name     string `json:"name"`
	Image    string `json:"image"`
	ImageID  string `json:"image_id,omitempty"`
	Ready    bool   `json:"ready"`
	Restarts int32  `json:"restarts"`
	Phase    string `json:"phase"`
	Reason   string `json:"reason,omitempty"`
}

type Controller

type Controller struct {
	Pod
	Observed      bool     `json:"observed"`
	Rendering     Phase    `json:"rendering"`
	Validation    Phase    `json:"validation"`
	Deployment    Phase    `json:"deployment"`
	ValidatedPlan string   `json:"validated_plan,omitempty"`
	LastFailure   *Failure `json:"last_failure,omitempty"`
}

type Failure

type Failure struct {
	Timestamp     time.Time `json:"timestamp"`
	Type          string    `json:"type"`
	CorrelationID string    `json:"correlation_id,omitempty"`
}

type Finding

type Finding struct {
	Code     string `json:"code"`
	Severity string `json:"severity"`
	Resource string `json:"resource,omitempty"`
	Action   string `json:"action"`
}

type Identity

type Identity struct {
	APIVersion string `json:"api_version"`
	Kind       string `json:"kind"`
	Namespace  string `json:"namespace,omitempty"`
	Name       string `json:"name"`
	UID        string `json:"uid,omitempty"`
	Generation int64  `json:"generation,omitempty"`
}

type Options

type Options struct {
	Namespace        string
	Release          string
	ConfigName       string
	DebugPort        int
	MaxResources     int
	MaxResponseBytes int64
}

type Phase

type Phase struct {
	Status    string    `json:"status"`
	Timestamp time.Time `json:"timestamp,omitzero"`
	Errors    int       `json:"error_count"`
}

type Pod

type Pod struct {
	Identity
	Ready      bool        `json:"ready"`
	Containers []Container `json:"containers"`
}

type PodAccess

type PodAccess interface {
	GetFromPod(context.Context, string, string, int64) ([]byte, error)
	Exec(context.Context, string, string, []string, int64) ([]byte, error)
}

type PodDeployment

type PodDeployment struct {
	Pod               string `json:"pod"`
	UID               string `json:"uid,omitempty"`
	Checksum          string `json:"checksum,omitempty"`
	AppliedPlanID     string `json:"applied_plan_id,omitempty"`
	RunningPlanID     string `json:"running_plan_id,omitempty"`
	ConsecutiveErrors int    `json:"consecutive_errors"`
	HasError          bool   `json:"has_error"`
}

type Report

type Report struct {
	SchemaVersion  int             `json:"schema_version"`
	CollectedAt    time.Time       `json:"collected_at"`
	Namespace      string          `json:"namespace"`
	Release        string          `json:"release"`
	Complete       bool            `json:"complete"`
	Healthy        bool            `json:"healthy"`
	Configurations []Configuration `json:"configurations"`
	Controllers    []Controller    `json:"controllers"`
	Agents         []Agent         `json:"agents"`
	Resources      []Resource      `json:"resources"`
	Findings       []Finding       `json:"findings"`
}

Report deliberately has no arbitrary payload fields; see CLAUDE.md.

type Resource

type Resource struct {
	Identity
	Watch      string      `json:"watch,omitempty"`
	Conditions []Condition `json:"conditions"`
}

Jump to

Keyboard shortcuts

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