core

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *zerolog.Logger

Functions

func BoolToFloat64

func BoolToFloat64(b bool) float64

BoolToFloat64 converts a bool to a float64 using the 0/1 convention shared by Prometheus gauges and similar numeric encodings of boolean state.

func FormatAgo

func FormatAgo(elapsed time.Duration) string

FormatAgo renders an elapsed duration as the compact relative age an operator page shows beside a timestamp: "just now" below a minute, then whole minutes, whole hours, and whole days. Each tier truncates rather than rounds, so the label never claims more elapsed time than there is.

A negative duration is clamped to zero and so reads as "just now". That is the shape clock skew takes between a machine that stamped an event and the machine rendering it, and a page that answers "in 3m" is reporting on the two clocks rather than on the event.

What an absent or zero timestamp means stays with the caller, because the surfaces that share this ladder do not agree on it: a fleet page that has never heard from a node says "never", while one describing a snapshot it just took says "now". This function starts once there is a duration to render, which is the part they do agree on.

func FormatTimeOrNever

func FormatTimeOrNever(t time.Time) string

FormatTimeOrNever renders a possibly-zero timestamp for human-readable output: the zero time becomes "never", anything else is formatted as UTC RFC 3339. Shared by alerting/reporting paths that describe when something was last observed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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