Documentation
¶
Overview ¶
Package logstore pkg/visor/logstore/logstore.go c3-vis-core
Index ¶
Constants ¶
const DefaultHookLevel = logrus.InfoLevel
DefaultHookLevel is the most verbose level the hook returned by MakeStore accepts.
It is deliberately not logrus.AllLevels. Fire below takes a process-wide mutex, allocates a new Entry via entry.WithField, runs a full logrus.JSONFormatter.Format and copies the result into a string — for every entry the visor emits, on top of the formatting the logger already did for its own output. Measured on a production node running at debug, ~67k lines/min reach a hook like this one; the store holds 300 entries, so at that rate the buffer `cli visor log` and the hypervisor log viewer read back is a sub-second window, bought by serializing the whole visor's logging through one mutex and a second JSON encode.
The visor's default log level is info (skyenv.LogLevel), so info-and-above is exactly what those readers see today — this only keeps the hot debug and trace paths out of the formatter and off the mutex.
const LogRealLineKey = "log_line"
LogRealLineKey is a key in the log entry that denotes real log line number in the total log (not limited by capacity of runtime log store)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store interface {
// GetLogs returns stored logs and the number of log entries overwritten
// due to insufficient capacity.
// returned number n means that n log entries have been dropped and the oldest
// log entry is (n+1)th
GetLogs() ([]string, int64)
// GetLogsSince returns stored entries whose log_line is strictly
// greater than since. The returned `dropped` is the number of
// entries the caller missed because they aged out of the ring
// buffer between calls (0 when the caller is keeping up). The
// returned `latest` is the highest log_line currently in the
// store — callers should pass it as `since` on the next call to
// receive only newly-arrived entries (diff streaming).
//
// since == 0 returns the entire buffer (equivalent to GetLogs).
// since >= latest returns an empty entry slice.
GetLogsSince(since int64) (entries []string, dropped int64, latest int64)
}
Store is in-memory log store that returns all logs as a single string