Documentation
¶
Index ¶
- Constants
- Variables
- func AdmitLinkedCall(ctx context.Context) bool
- func CursorOffset(scope string, query Query, digest string, now time.Time) (int, time.Time, error)
- func Identity(snapshot Snapshot) string
- func Level(text string) string
- func ManifestIdentity(root string, at time.Time) string
- func Merge(current *State, incoming []Snapshot, gaps []Gap, job string, now time.Time) error
- func MergeManifests(state *State, incoming []Manifest, now time.Time) error
- func NextCursor(scope string, query Query, digest string, offset int, observed time.Time) string
- func ObservePods(state *State, pods []ManifestPod, now time.Time)
- func PodPriority(pod ManifestPod) int
- func ResolveLinkedLine(pods []ManifestPod, line LinkedLine) (ManifestPod, ManifestContainer, bool)
- func SettingsKey(org, cluster string) string
- func TerminationEnd(at time.Time) time.Time
- func UpdateSettings(provider storage.Provider, key string, update func(*SettingsState) error) error
- type Alerts
- type CaptureSettings
- type ContainerObservation
- type Coverage
- type Fields
- type Gap
- type Health
- type Learning
- type Line
- type LinkedLine
- type LinkedQuery
- type LinkedReader
- type Manifest
- type ManifestContainer
- type ManifestPod
- type Query
- type ReadError
- type Result
- type Scope
- type Settings
- type SettingsState
- type Snapshot
- type Source
- type State
Constants ¶
const AllContainers = "*"
AllContainers is the Container value that merges every container's lines.
const ClockTolerance = 5 * time.Second
ClockTolerance permits bounded replica skew without rewriting evidence time.
const MaxBytes = 8 << 20
const MaxHistoryBytesPerRoot = 64 << 10
const MaxHistoryPodsPerRoot = 2 * MaxManifestPods
const MaxManifestPods = 20
const MaxMetadataBytes = 2 << 20
const MaxSnapshots = 2000
const Retention = 24 * time.Hour
Variables ¶
var ErrInvalid = errors.New("invalid break logs request")
Functions ¶
func AdmitLinkedCall ¶ added in v1.4.34
AdmitLinkedCall is shared by all pod reads and time splits in one query.
func CursorOffset ¶
func MergeManifests ¶ added in v1.4.34
func NextCursor ¶
func ObservePods ¶ added in v1.4.34
func ObservePods(state *State, pods []ManifestPod, now time.Time)
ObservePods retains only verified owner-chain metadata from complete inventory. Unknown lifetimes remain unknown; a name or workload prefix is never proof.
func PodPriority ¶ added in v1.4.34
func PodPriority(pod ManifestPod) int
PodPriority orders irreplaceable retired identity, broken live identity, then resampleable healthy live identity, both globally and within each workload.
func ResolveLinkedLine ¶ added in v1.4.34
func ResolveLinkedLine(pods []ManifestPod, line LinkedLine) (ManifestPod, ManifestContainer, bool)
ResolveLinkedLine refuses overlapping same-name UIDs and unobserved restarts.
func SettingsKey ¶
func TerminationEnd ¶ added in v1.4.34
TerminationEnd includes the complete second reported by Kubernetes status, whose whole-second timestamps bound nanosecond kubelet log timestamps.
func UpdateSettings ¶
Types ¶
type CaptureSettings ¶
type CaptureSettings struct {
LinkedSource string `json:"linked_source"`
Fields map[string]Fields `json:"fields"`
IngestDelay *int `json:"ingest_delay,omitempty"`
}
func (CaptureSettings) IngestionDelay ¶ added in v1.4.34
func (settings CaptureSettings) IngestionDelay(kind string) time.Duration
type ContainerObservation ¶
type Coverage ¶
type Coverage struct {
State string `json:"state"`
Gaps []Gap `json:"gaps"`
Reason string `json:"reason,omitempty"`
Tip bool `json:"tip"`
}
func Assess ¶
func Assess(from, to time.Time, snapshots []Snapshot, container ContainerObservation) Coverage
type Fields ¶
type Fields struct {
Namespace string `json:"namespace"`
Pod string `json:"pod"`
Container string `json:"container"`
Time string `json:"time,omitempty"`
Message string `json:"message,omitempty"`
}
func DefaultFields ¶
type Gap ¶
type Gap struct {
ReadyAt time.Time `json:"ready_at,omitempty,omitzero"`
SnapshotID string `json:"snapshot_id,omitempty"`
ObservedAt time.Time `json:"observed_at,omitempty,omitzero"`
From time.Time `json:"from"`
To time.Time `json:"to"`
Namespace string `json:"namespace,omitempty"`
RootUID string `json:"root_uid,omitempty"`
PodUID string `json:"pod_uid,omitempty"`
Container string `json:"container,omitempty"`
Reason string `json:"reason,omitempty"`
}
func ResolveBudgetGaps ¶
type LinkedLine ¶
type LinkedQuery ¶
type LinkedQuery struct {
Namespace string
PodPrefix string
Pods []string
Container string
From, To time.Time
Limit int
}
func (LinkedQuery) Validate ¶
func (query LinkedQuery) Validate() error
type LinkedReader ¶
type LinkedReader interface {
Read(context.Context, LinkedQuery) (Result, error)
Preview(LinkedQuery) string
}
type Manifest ¶ added in v1.4.34
type Manifest struct {
ID string `json:"id"`
OccurrenceID string `json:"occurrence_id,omitempty"`
Namespace string `json:"namespace"`
RootUID string `json:"root_uid"`
BreakAt time.Time `json:"break_at"`
From time.Time `json:"from"`
To time.Time `json:"to"`
CapturedAt time.Time `json:"captured_at"`
Pods []ManifestPod `json:"pods"`
Truncated bool `json:"truncated,omitempty"`
SettleAt time.Time `json:"settle_at,omitempty,omitzero"`
Attempts int `json:"attempts"`
Done bool `json:"done,omitempty"`
SettlingUntil time.Time `json:"settling_until,omitempty,omitzero"`
SettleEpoch time.Time `json:"settle_epoch,omitempty,omitzero"`
}
Manifest contains identity evidence, never labels, environment or log text.
type ManifestContainer ¶ added in v1.4.34
type ManifestContainer struct {
Name string `json:"name"`
Init bool `json:"init,omitempty"`
Restarts int32 `json:"restarts"`
StartedAt time.Time `json:"started_at,omitempty,omitzero"`
TerminationAt time.Time `json:"termination_at,omitempty,omitzero"`
TerminationReason string `json:"termination_reason,omitempty"`
TerminationExitCode int32 `json:"termination_exit_code,omitempty"`
PreviousStartedAt time.Time `json:"previous_started_at,omitempty,omitzero"`
CurrentTermination bool `json:"current_termination,omitempty"`
CurrentEndedAt time.Time `json:"current_ended_at,omitempty,omitzero"`
}
type ManifestPod ¶ added in v1.4.34
type ManifestPod struct {
Namespace string `json:"namespace"`
RootUID string `json:"root_uid"`
Name string `json:"name"`
UID string `json:"uid"`
Node string `json:"node,omitempty"`
Broken bool `json:"broken,omitempty"`
CreatedAt time.Time `json:"created_at"`
// LastSeen bounds a vanished pod when its exact deletion time is unknown.
// A later complete inventory proves absence, not survival until that LIST.
LastSeen time.Time `json:"last_seen"`
DeletedAt time.Time `json:"deleted_at,omitempty,omitzero"`
Containers []ManifestContainer `json:"containers"`
}
type Query ¶
type Query struct {
OccurrenceID string
Center time.Time
Namespace, RootUID, Mode, Level, Search, Cursor string
// Container selects one container by name. Empty asks for the break's main
// container and AllContainers merges every container.
Container string
Pods []string
From, To time.Time
Limit int
}
type ReadError ¶ added in v1.4.34
type ReadError struct {
Class string
}
ReadError is a safe upstream class. It deliberately contains neither the upstream response body nor credential-bearing transport/configuration text.
type Result ¶
type Result struct {
Lines []LinkedLine
Truncated bool
Complete []Gap
Rejected bool
}
func ReadWindow ¶ added in v1.4.34
func ReadWindow(ctx context.Context, reader LinkedReader, query LinkedQuery) (Result, error)
ReadWindow spends a whole-query budget, not a per-split line budget. Only disjoint, non-truncated leaves can claim coverage. Three logical queries and 6000 returned lines are ceilings, not a promise of completeness. Native adapters batch the verified Pod set in each query and separately bound pages/lifecycle requests; truncation leaves explicit gaps.
type Settings ¶
type Settings struct {
Learning Learning `json:"learning"`
BreakLogs CaptureSettings `json:"break_logs"`
Alerts Alerts `json:"alerts"`
}
type SettingsState ¶
type SettingsState struct {
Settings Settings `json:"settings"`
Health map[string]Health `json:"health"`
}
func LoadSettings ¶
func LoadSettings(provider storage.Provider, key string) (SettingsState, error)
type Snapshot ¶
type Snapshot struct {
Source string `json:"source,omitempty"`
OccurrenceID string `json:"occurrence_id,omitempty"`
BreakAt time.Time `json:"break_at,omitempty,omitzero"`
ID string `json:"id"`
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
RootUID string `json:"root_uid"`
Pod string `json:"pod"`
PodUID string `json:"pod_uid"`
PodCreatedAt time.Time `json:"pod_created_at,omitempty,omitzero"`
Container string `json:"container"`
Init bool `json:"init"`
Slot string `json:"slot"`
TerminationAt time.Time `json:"termination_at,omitempty,omitzero"`
TerminationReason string `json:"termination_reason,omitempty"`
TerminationExitCode int32 `json:"termination_exit_code,omitempty"`
Restarts int32 `json:"restarts"`
CapturedAt time.Time `json:"captured_at"`
From time.Time `json:"from"`
To time.Time `json:"to"`
Lines []Line `json:"lines"`
Truncated bool `json:"truncated"`
}
type State ¶
type State struct {
PodHistoryAt time.Time `json:"pod_history_at,omitempty,omitzero"`
PodHistoryTruncatedAt time.Time `json:"pod_history_truncated_at,omitempty,omitzero"`
PodHistoryGaps []Gap `json:"pod_history_gaps,omitempty"`
Manifests []Manifest `json:"manifests,omitempty"`
PodHistory []ManifestPod `json:"pod_history,omitempty"`
Snapshots []Snapshot `json:"snapshots"`
Gaps []Gap `json:"gaps"`
Jobs map[string]time.Time `json:"jobs,omitempty"`
}