capture

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtifactNames

func ArtifactNames(artifacts []Artifact) []string

func DecodePayload

func DecodePayload(payloadType string, payloadBlob []byte, payloadJSON string) ([]byte, error)

DecodePayload returns the decoded payload bytes for a captured event row. It supports the current `json+gzip` encoding and falls back to the stored JSON text.

func LatestArtifactText

func LatestArtifactText(artifacts []Artifact, name string) string

func ResolvePath

func ResolvePath(commandPath, requested string, now time.Time) (string, error)

ResolvePath expands capture paths. If requested is empty or "__auto__", it creates a default filename in the current working directory.

Types

type Artifact

type Artifact struct {
	Seq  int64
	TS   time.Time
	Name string
	Text string
}

func ReadArtifacts

func ReadArtifacts(ctx context.Context, path string, names ...string) ([]Artifact, error)

type CaptureSummary

type CaptureSummary struct {
	Path        string           `json:"path"`
	GeneratedAt time.Time        `json:"generatedAt"`
	Sessions    []SessionSummary `json:"sessions"`
}

func Summarize

func Summarize(ctx context.Context, path string, opts SummaryOptions) (*CaptureSummary, error)

Summarize reads a capture SQLite database and returns a compact explanation-oriented summary.

type Cause

type Cause struct {
	Category string   `json:"category"`
	Severity string   `json:"severity"`
	Resource string   `json:"resource,omitempty"`
	Message  string   `json:"message"`
	Evidence string   `json:"evidence,omitempty"`
	Fixes    []string `json:"fixes,omitempty"`
}

type ChangeSummary

type ChangeSummary struct {
	HasDiff           bool `json:"hasDiff,omitempty"`
	DiffLines         int  `json:"diffLines,omitempty"`
	ManifestBytes     int  `json:"manifestBytes,omitempty"`
	ManifestResources int  `json:"manifestResources,omitempty"`
}

type CommandSuggestion

type CommandSuggestion struct {
	Purpose string `json:"purpose"`
	Command string `json:"command"`
}

type Entities

type Entities struct {
	Cluster      string
	KubeContext  string
	Namespace    string
	Release      string
	Chart        string
	ImageRef     string
	ImageDigest  string
	BuildContext string
}

type EventMeta

type EventMeta struct {
	Kind      string
	Level     string
	Source    string
	Namespace string
	Pod       string
	Container string
	Message   string
}

type FailureHint

type FailureHint struct {
	Seq       int64     `json:"seq,omitempty"`
	TS        time.Time `json:"ts,omitempty"`
	Kind      string    `json:"kind,omitempty"`
	Level     string    `json:"level,omitempty"`
	Source    string    `json:"source,omitempty"`
	Namespace string    `json:"namespace,omitempty"`
	Pod       string    `json:"pod,omitempty"`
	Container string    `json:"container,omitempty"`
	Message   string    `json:"message,omitempty"`
}

type PolicySummary

type PolicySummary struct {
	Passed    bool `json:"passed"`
	DenyCount int  `json:"denyCount"`
	WarnCount int  `json:"warnCount"`
}

type Recorder

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

func Open

func Open(path string, meta SessionMeta) (*Recorder, error)

func (*Recorder) Close

func (r *Recorder) Close() error

func (*Recorder) HandleDeployEvent

func (r *Recorder) HandleDeployEvent(evt deploy.StreamEvent)

func (*Recorder) ObserveLog

func (r *Recorder) ObserveLog(rec tailer.LogRecord)

func (*Recorder) ObserveSelection

func (r *Recorder) ObserveSelection(sel tailer.SelectionSnapshot)

func (*Recorder) RecordArtifact

func (r *Recorder) RecordArtifact(ctx context.Context, name, text string) error

func (*Recorder) RecordDeployEvent

func (r *Recorder) RecordDeployEvent(ctx context.Context, evt deploy.StreamEvent) error

func (*Recorder) RecordEvent

func (r *Recorder) RecordEvent(ctx context.Context, meta EventMeta, payload any) error

func (*Recorder) RecordLog

func (r *Recorder) RecordLog(ctx context.Context, rec tailer.LogRecord) error

func (*Recorder) RecordSelection

func (r *Recorder) RecordSelection(ctx context.Context, sel tailer.SelectionSnapshot) error

func (*Recorder) RunID

func (r *Recorder) RunID() string

func (*Recorder) SessionID

func (r *Recorder) SessionID() string

type ResourceHint

type ResourceHint struct {
	Resource string `json:"resource"`
	Count    int    `json:"count"`
}

type SessionMeta

type SessionMeta struct {
	Command     string            `json:"command"`
	Args        []string          `json:"args,omitempty"`
	RunID       string            `json:"runId,omitempty"`
	ParentRunID string            `json:"parentRunId,omitempty"`
	StartedAt   time.Time         `json:"startedAt"`
	Host        string            `json:"host,omitempty"`
	User        string            `json:"user,omitempty"`
	Extra       map[string]string `json:"extra,omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`
	Entities    Entities          `json:"entities,omitempty"`
}

type SessionSummary

type SessionSummary struct {
	SessionID       string              `json:"sessionId"`
	RunID           string              `json:"runId,omitempty"`
	ParentRunID     string              `json:"parentRunId,omitempty"`
	Command         string              `json:"command"`
	Args            []string            `json:"args,omitempty"`
	StartedAt       time.Time           `json:"startedAt"`
	EndedAt         *time.Time          `json:"endedAt,omitempty"`
	Duration        string              `json:"duration,omitempty"`
	Outcome         string              `json:"outcome"`
	Host            string              `json:"host,omitempty"`
	User            string              `json:"user,omitempty"`
	Tags            map[string]string   `json:"tags,omitempty"`
	Extra           map[string]string   `json:"extra,omitempty"`
	Entities        Entities            `json:"entities,omitempty"`
	DroppedEvents   int64               `json:"droppedEvents,omitempty"`
	EventCount      int                 `json:"eventCount"`
	ArtifactCount   int                 `json:"artifactCount"`
	EventKinds      map[string]int      `json:"eventKinds,omitempty"`
	EventSources    map[string]int      `json:"eventSources,omitempty"`
	ChangeSummary   ChangeSummary       `json:"changeSummary,omitempty"`
	PrimaryCause    *Cause              `json:"primaryCause,omitempty"`
	Causes          []Cause             `json:"causes,omitempty"`
	FailureHints    []FailureHint       `json:"failureHints,omitempty"`
	ResourceHints   []ResourceHint      `json:"resourceHints,omitempty"`
	ArtifactNames   []string            `json:"artifactNames,omitempty"`
	BuildDigest     string              `json:"buildDigest,omitempty"`
	BuildTags       []string            `json:"buildTags,omitempty"`
	BuildPolicy     *PolicySummary      `json:"buildPolicy,omitempty"`
	ApplyStatus     string              `json:"applyStatus,omitempty"`
	StackNodeCount  int                 `json:"stackNodeCount,omitempty"`
	ReviewCommand   string              `json:"reviewCommand,omitempty"`
	RollbackCommand string              `json:"rollbackCommand,omitempty"`
	LogsCommand     string              `json:"logsCommand,omitempty"`
	FixCommands     []CommandSuggestion `json:"fixCommands,omitempty"`
	Suggestions     []string            `json:"suggestions,omitempty"`
}

type SummaryOptions

type SummaryOptions struct {
	SessionID       string
	MaxFailureHints int
	MaxResources    int
}

Jump to

Keyboard shortcuts

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