MCPcopy Index your code
hub / github.com/kubernetes/node-problem-detector / NewLogBuffer

Function NewLogBuffer

pkg/systemlogmonitor/log_buffer.go:48–54  ·  view source on GitHub ↗

NewLogBuffer creates log buffer with max line number limit. Because we only match logs in the log buffer, the max buffer line number is also the max pattern line number we support. Smaller buffer line number means less memory and cpu usage, but also means less lines of patterns we support.

(maxLines int)

Source from the content-addressed store, hash-verified

46// support. Smaller buffer line number means less memory and cpu usage, but also means less
47// lines of patterns we support.
48func NewLogBuffer(maxLines int) *logBuffer {
49 return &logBuffer{
50 buffer: make([]*types.Log, maxLines),
51 msg: make([]string, maxLines),
52 max: maxLines,
53 }
54}
55
56func (b *logBuffer) Push(log *types.Log) {
57 b.buffer[b.current%b.max] = log

Callers 5

NewTestLogCounterFunction · 0.92
NewJournaldLogCounterFunction · 0.92
TestPushFunction · 0.85
TestMatchFunction · 0.85
NewLogMonitorOrDieFunction · 0.85

Calls

no outgoing calls

Tested by 3

NewTestLogCounterFunction · 0.74
TestPushFunction · 0.68
TestMatchFunction · 0.68