reporter

package
v0.22.6 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEventForCurrentState

func CreateEventForCurrentState(pod *v1.Pod, clusterId string, classifyResult categorizer.ClassifyResult, debugMessage string) (*armadaevents.EventSequence, error)

CreateEventForCurrentState builds the armada event for pod's current phase. For failed pods the caller supplies the classification result to attach to the event, along with an optional debugMessage (rendered k8s events) to include on the PodError.

func CreateJobFailedEvent

func CreateJobFailedEvent(pod *v1.Pod, reason string, cause armadaevents.KubernetesReason, debugMessage string,
	containerStatuses []*armadaevents.ContainerError, clusterId string, failureCategory string, failureSubcategory string,
) (*armadaevents.EventSequence, error)

func CreateJobIngressInfoEvent

func CreateJobIngressInfoEvent(pod *v1.Pod, clusterId string, associatedServices []*v1.Service, associatedIngresses []*networking.Ingress) (*armadaevents.EventSequence, error)

func CreateJobRunTerminatedDebugEvent added in v0.22.6

func CreateJobRunTerminatedDebugEvent(pod *v1.Pod, debugMessage string) (*armadaevents.EventSequence, error)

CreateJobRunTerminatedDebugEvent creates a JobRunTerminatedDebugInfo event carrying the rendered debug message for a run that is being torn down without its workload having completed. It is purely diagnostic: it is NOT an error and does NOT change the run's state. Only Lookout consumes it, to populate the run's debug column.

func CreateJobUtilisationEvent

func CreateJobUtilisationEvent(pod *v1.Pod, utilisationData *domain.UtilisationDataAggregation, clusterId string) (*armadaevents.EventSequence, error)

func CreateMinimalJobFailedEvent added in v0.4.36

func CreateMinimalJobFailedEvent(jobId string, runId string, jobSet string, queue string, clusterId string, message string, failureCategory string, failureSubcategory string) (*armadaevents.EventSequence, error)

func CreateReturnLeaseEvent added in v0.3.47

func CreateReturnLeaseEvent(pod *v1.Pod, reason string, debugMessage string, clusterId string, runAttempted bool,
	failureCategory string, failureSubcategory string,
) (*armadaevents.EventSequence, error)

CreateReturnLeaseEvent builds the lease-return error event for a run the scheduler should retry. failureCategory and failureSubcategory carry the pod error classification when the caller has one; empty strings mean the failure was not classified and leave the fields unset.

func CreateSimpleJobFailedEvent

func CreateSimpleJobFailedEvent(pod *v1.Pod, reason string, clusterId string, cause armadaevents.KubernetesReason) (*armadaevents.EventSequence, error)

CreateSimpleJobFailedEvent creates a failed event with no container details or failure category, for failures where pod container statuses are unavailable (preemption, submit failures).

func CreateSimpleJobPreemptedEvent added in v0.3.57

func CreateSimpleJobPreemptedEvent(pod *v1.Pod) (*armadaevents.EventSequence, error)

Types

type ConditionInfo added in v0.22.6

type ConditionInfo struct {
	Type    string `json:"type"`
	Status  string `json:"status"`
	Reason  string `json:"reason,omitempty"`
	Message string `json:"message,omitempty"`
}

type ContainerInfo added in v0.22.6

type ContainerInfo struct {
	Name string `json:"name"`
	// RestartPolicy is set only where a container overrides the pod's - an init container with
	// Always is a native sidecar, running alongside the app containers rather than before them.
	RestartPolicy string `json:"restartPolicy,omitempty"`
	State         string `json:"state"`
	ExitCode      *int32 `json:"exitCode,omitempty"`
	Reason        string `json:"reason,omitempty"`
	RunSeconds    *int64 `json:"runSeconds,omitempty"`
}

type DebugMessageRenderer added in v0.22.6

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

DebugMessageRenderer builds the JSON debug payload for a pod.

func NewDebugMessageRenderer added in v0.22.6

func NewDebugMessageRenderer(nodes nodeSource, config configuration.DebugEventsConfig) *DebugMessageRenderer

func (*DebugMessageRenderer) Render added in v0.22.6

func (r *DebugMessageRenderer) Render(pod *v1.Pod, podEvents []*v1.Event, trigger DebugTrigger) string

Render returns the JSON payload, or an empty string when capture is disabled or the payload could not be serialized. Callers attach the result unconditionally: an empty debug field is how every event looked before this existed, so the kill switch lives here rather than at each call site.

type DebugTrigger added in v0.22.6

type DebugTrigger string

DebugTrigger records why the debug data was captured, so a reader can select comparable records.

const (
	TriggerPodFailed              DebugTrigger = "podFailed"
	TriggerCancelledNotStarted    DebugTrigger = "cancelledNotStarted"
	TriggerStuckTerminating       DebugTrigger = "stuckTerminating"
	TriggerUndeletable            DebugTrigger = "undeletable"
	TriggerPreempted              DebugTrigger = "preempted"
	TriggerExternallyDeleted      DebugTrigger = "externallyDeleted"
	TriggerActiveDeadlineExceeded DebugTrigger = "activeDeadlineExceeded"
)

type EventInfo added in v0.22.6

type EventInfo struct {
	Type      string `json:"type,omitempty"`
	Reason    string `json:"reason,omitempty"`
	From      string `json:"from,omitempty"`
	Message   string `json:"message,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
}

type EventMessage added in v0.3.47

type EventMessage struct {
	Event    *armadaevents.EventSequence
	JobRunId string
}

type EventReporter

type EventReporter interface {
	Report(events []EventMessage) error
	QueueEvent(event EventMessage, callback func(error))
	HasPendingEvents(pod *v1.Pod) bool
}

type EventSender added in v0.3.47

type EventSender interface {
	SendEvents(events []EventMessage) error
}

type ExecutorApiEventSender added in v0.3.47

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

func NewExecutorApiEventSender added in v0.3.47

func NewExecutorApiEventSender(
	executorApiClient executorapi.ExecutorApiClient,
	maxMessageSize int,
) *ExecutorApiEventSender

func (*ExecutorApiEventSender) SendEvents added in v0.3.47

func (eventSender *ExecutorApiEventSender) SendEvents(events []EventMessage) error

type JobEventReporter

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

func NewJobEventReporter

func NewJobEventReporter(
	eventSender EventSender,
	clock clock.WithTicker,
	maxBatchSize int,
) (*JobEventReporter, chan bool)

func (*JobEventReporter) HasPendingEvents added in v0.16.2

func (eventReporter *JobEventReporter) HasPendingEvents(pod *v1.Pod) bool

func (*JobEventReporter) QueueEvent

func (eventReporter *JobEventReporter) QueueEvent(event EventMessage, callback func(error))

func (*JobEventReporter) Report

func (eventReporter *JobEventReporter) Report(events []EventMessage) error

type NodeInfo added in v0.22.6

type NodeInfo struct {
	Name string `json:"name"`
	// Exists is false when the pod outlived the node it was assigned to.
	Exists        *bool  `json:"exists,omitempty"`
	Unschedulable *bool  `json:"unschedulable,omitempty"`
	Ready         string `json:"ready,omitempty"`
	ReadyReason   string `json:"readyReason,omitempty"`
	// Only the labels and annotations named in config are captured.
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Conditions  []ConditionInfo   `json:"conditions,omitempty"`
	Events      []EventInfo       `json:"events,omitempty"`
}

type PodDebugInfo added in v0.22.6

type PodDebugInfo struct {
	SchemaVersion int          `json:"schemaVersion"`
	Trigger       DebugTrigger `json:"trigger"`
	Pod           PodInfo      `json:"pod"`
	Node          *NodeInfo    `json:"node,omitempty"`
}

PodDebugInfo is the debug field of PodError and JobRunTerminatedDebugInfo events, serialized as JSON. Scalars are intended to become columns when these payloads are loaded for ad-hoc analysis, so durations are seconds and timestamps are RFC3339.

type PodInfo added in v0.22.6

type PodInfo struct {
	Phase  string `json:"phase,omitempty"`
	Reason string `json:"reason,omitempty"`
	// RestartPolicy is the pod's, which app containers inherit. Init containers can override it, so
	// theirs is reported per container.
	RestartPolicy string `json:"restartPolicy,omitempty"`

	// Set only for a pod Kubernetes has been asked to delete.
	DeletionTimestamp string   `json:"deletionTimestamp,omitempty"`
	ForceTerminated   *bool    `json:"forceTerminated,omitempty"`
	Finalizers        []string `json:"finalizers,omitempty"`

	InitContainers []ContainerInfo `json:"initContainers,omitempty"`
	Containers     []ContainerInfo `json:"containers,omitempty"`
	Events         []EventInfo     `json:"events,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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