Documentation
¶
Overview ¶
Package activity keeps the raw activity facts one process of the laboratory hands, through the agent API, to the platform that runs it (the daemon): internet egress, console sessions, devices touched over the VPN. The facts sit in a bounded ring of a LabActivityReport in the group namespace; the agent reads them. The laboratory aggregates nothing and sends nothing anywhere by itself. Everything is off unless the chart value activityReports.enabled is true: a nil *Hub is the disabled state, and every method of it is a no-op.
Index ¶
Constants ¶
const ( MaxEvents = 1000 MaxAge = time.Hour )
The bounds of one writer's ring in one namespace.
const EnvEnabled = "ACTIVITY_REPORTS"
EnvEnabled is the variable every process reads (the chart sets it from activityReports.enabled).
const FlushEvery = time.Minute
FlushEvery is how often a writer looks for events to write: at most one write per ring per minute, and none when nothing is new.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
func Enabled() bool
Enabled reports whether this process was told to keep activity reports (chart value activityReports.enabled).
func ReportName ¶
ReportName is the name of the LabActivityReport of a writer ("vpn", "egress", "proxy-<pod>").
Types ¶
type Hub ¶
type Hub struct {
Client client.Client
// Reader reads the report back before it is written (default: Client). Give an uncached reader where the process has no list and watch
// right on the reports.
Reader client.Reader
Writer string
MaxEvents int
MaxAge time.Duration
Now func() time.Time
OnError func(error)
// contains filtered or unexported fields
}
Hub is the rings of one writer, one per group namespace.
func (*Hub) Add ¶
func (h *Hub) Add(namespace string, ev laboratoryv1alpha1.ActivityEvent)
Add appends an event to the ring of a namespace. Seq is set here. A nil Hub (reports disabled) does nothing.
func (*Hub) Events ¶
func (h *Hub) Events(namespace string) []laboratoryv1alpha1.ActivityEvent
Events returns a copy of the ring of a namespace (what the next flush writes).