events

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package events scans the apiserver's recent Event stream and aggregates per-namespace warning counts, surfacing clusters whose signal-to-noise has degraded.

Index

Constants

View Source
const Name = "events"

Name is the registry key for this scanner.

Variables

This section is empty.

Functions

func NewScanner

func NewScanner() scanner.Scanner

NewScanner returns a scanner that collects Kubernetes warning events from the most recent warningWindow only. The field selector pushes the type filter to the apiserver so a 200-node cluster with thousands of Normal events does not stream all of them across the wire.

Types

type Data

type Data struct {
	// TotalEvents is the total number of warning events within the time window.
	TotalEvents int `json:"total_events"`
	// WarningEvents is the number of Warning-type events within the window.
	WarningEvents int `json:"warning_events"`
	// NormalEvents is always zero (kept for backward compatibility); the scanner
	// no longer ingests Normal events because they are pure noise at fleet scale.
	NormalEvents int `json:"normal_events"`
	// TopWarningReasons lists the most common warning event reasons.
	TopWarningReasons []ReasonSummary `json:"top_warning_reasons"`
	// RecentWarnings lists the most recent warning events.
	RecentWarnings []EventInfo `json:"recent_warnings"`
	// WindowSeconds is the lookback window the scan honored, in seconds.
	WindowSeconds int `json:"window_seconds"`
}

Data holds event information for one cluster.

type EventInfo

type EventInfo struct {
	// Namespace is the namespace of the involved object.
	Namespace string `json:"namespace"`
	// InvolvedObject describes the object this event is about.
	InvolvedObject string `json:"involved_object"`
	// Kind is the kind of the involved object (Pod, Node, etc.).
	Kind string `json:"kind"`
	// Reason is the short machine-readable reason.
	Reason string `json:"reason"`
	// Message is the human-readable event message.
	Message string `json:"message"`
	// Type is Normal or Warning.
	Type string `json:"type"`
	// Count is how many times this event has occurred.
	Count int32 `json:"count"`
	// FirstSeen is when the event was first observed.
	FirstSeen string `json:"first_seen"`
	// LastSeen is when the event was last observed.
	LastSeen string `json:"last_seen"`
}

EventInfo describes a single Kubernetes event.

type ReasonSummary

type ReasonSummary struct {
	// Reason is the event reason.
	Reason string `json:"reason"`
	// Count is the total occurrences across all events with this reason.
	Count int32 `json:"count"`
	// EventCount is the number of distinct events with this reason.
	EventCount int `json:"event_count"`
}

ReasonSummary aggregates events by reason.

Jump to

Keyboard shortcuts

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