workerdiagnostics

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion           = 1
	DefaultMaxArtifacts     = 32
	DefaultMaxArtifactBytes = 2 * 1024 * 1024
)
View Source
const DurableWALHighWatermarkPercent = 80

Variables

This section is empty.

Functions

func AtDurableWALHighWatermark

func AtDurableWALHighWatermark(stats SpoolStats, maximumBytes int64) bool

AtDurableWALHighWatermark closes new admission before the hard byte ceiling makes the next teardown unable to persist evidence. Equality is degraded.

func IsBundleName

func IsBundleName(name string) bool

IsBundleName reports whether name belongs to the versioned diagnostic spool grammar. Exporters and observers use the same boundary as retention cleanup.

func Redact

func Redact(input []byte) []byte

Types

type Artifact

type Artifact struct {
	Path      string
	Source    string
	Content   []byte
	Truncated bool
}

type ArtifactRecord

type ArtifactRecord struct {
	Path      string `json:"path"`
	Source    string `json:"source"`
	Bytes     int    `json:"bytes"`
	SHA256    string `json:"sha256"`
	Truncated bool   `json:"truncated"`
}

type Instance

type Instance struct {
	Name             string `json:"name"`
	Trust            string `json:"trust,omitempty"`
	ControllerID     string `json:"controller_id"`
	PoolID           string `json:"pool_id"`
	PoolName         string `json:"pool_name"`
	ScaleSet         string `json:"scale_set"`
	Repository       string `json:"repository"`
	ImageFingerprint string `json:"image_fingerprint"`
	RunnerVersion    string `json:"runner_version"`
	ProviderVersion  string `json:"provider_version"`
	ProviderCommit   string `json:"provider_commit"`
	State            string `json:"state"`
}

type Manifest

type Manifest struct {
	SchemaVersion    int              `json:"schema_version"`
	CapturedAt       string           `json:"captured_at"`
	Instance         Instance         `json:"instance"`
	Artifacts        []ArtifactRecord `json:"artifacts"`
	CollectionErrors []string         `json:"collection_errors"`
}

type Result

type Result struct {
	Path               string `json:"path"`
	ArtifactCount      int    `json:"artifact_count"`
	UncompressedBytes  int64  `json:"uncompressed_bytes"`
	CollectionFailures int    `json:"collection_failures"`
}

type SpoolStats

type SpoolStats struct {
	Bundles          int   `json:"bundles"`
	Bytes            int64 `json:"bytes"`
	OldestAgeSeconds int64 `json:"oldest_age_seconds"`
	NewestAgeSeconds int64 `json:"newest_age_seconds"`
}

func Inspect

func Inspect(directory string, now time.Time) (SpoolStats, error)

Inspect returns aggregate metadata for provider-owned diagnostic bundles. It uses the same private-directory and filename boundary as retention GC and never opens bundle contents or follows symlinks.

type Store

type Store struct {
	Directory      string
	Retention      time.Duration
	MaxBundleBytes int64
	MaxTotalBytes  int64
	MaxArtifacts   int
	Now            func() time.Time
	Random         io.Reader
}

func (Store) Write

func (s Store) Write(
	ctx context.Context,
	instance Instance,
	artifacts []Artifact,
	collectionErrors []string,
) (Result, error)

Jump to

Keyboard shortcuts

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