Documentation ¶
Index ¶
- func EnsureLoggingAgentDeployment(f *framework.Framework, appName string) error
- func EnsureLoggingAgentRestartsCount(f *framework.Framework, appName string, maxRestarts int) error
- func GetNodeIds(cs clientset.Interface) []string
- func WaitForLogs(c LogChecker, interval, timeout time.Duration) error
- type FiniteLoggingPod
- type IngestionPred
- type LogChecker
- func NewFullIngestionPodLogChecker(p LogProvider, slack float64, pods ...FiniteLoggingPod) LogChecker
- func NewLogChecker(p LogProvider, pred IngestionPred, timeout TimeoutFun, names ...string) LogChecker
- func NewNumberedLogChecker(p LogProvider, pred NumberedIngestionPred, timeout NumberedTimeoutFun, ...) LogChecker
- type LogEntry
- type LogProvider
- type LoggingPod
- type LogsQueueCollection
- type NumberedIngestionPred
- type NumberedTimeoutFun
- type TimeoutFun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureLoggingAgentDeployment ¶
EnsureLoggingAgentDeployment checks that logging agent is present on each node and returns an error if that's not true.
func EnsureLoggingAgentRestartsCount ¶
EnsureLoggingAgentRestartsCount checks that each logging agent was restarted no more than maxRestarts times and returns an error if there's a pod which exceeds this number of restarts.
func GetNodeIds ¶
GetNodeIds returns the list of node names and panics in case of failure.
func WaitForLogs ¶
func WaitForLogs(c LogChecker, interval, timeout time.Duration) error
WaitForLogs checks that logs are ingested, as reported by the log checker until the timeout has passed. Function sleeps for interval between two log ingestion checks.
Types ¶
type FiniteLoggingPod ¶
type FiniteLoggingPod interface { LoggingPod // ExpectedLinesNumber returns the number of lines that are // expected to be ingested from this pod. ExpectedLineCount() int }
FiniteLoggingPod is a logging pod that emits a known number of log lines.
func NewLoadLoggingPod ¶
func NewLoadLoggingPod(podName string, nodeName string, totalLines int, loggingDuration time.Duration) FiniteLoggingPod
NewLoadLoggingPod returns a logging pod that generates totalLines random lines over period of length loggingDuration. Lines generated by this pod are numbered and have well-defined structure.
type IngestionPred ¶
IngestionPred is a type of a function that checks whether all required log entries were ingested.
var UntilFirstEntry IngestionPred = func(_ string, entries []LogEntry) (bool, error) { return len(entries) > 0, nil }
UntilFirstEntry is a IngestionPred that checks that at least one entry was ingested.
func UntilFirstEntryFromLocation ¶
func UntilFirstEntryFromLocation(location string) IngestionPred
UntilFirstEntryFromLocation is a IngestionPred that checks that at least one entry from the log with a given name was ingested.
func UntilFirstEntryFromLog ¶
func UntilFirstEntryFromLog(log string) IngestionPred
UntilFirstEntryFromLog is a IngestionPred that checks that at least one entry from the log with a given name was ingested.
type LogChecker ¶
LogChecker is an interface for an entity that can check whether logging backend contains all wanted log entries.
func NewFullIngestionPodLogChecker ¶
func NewFullIngestionPodLogChecker(p LogProvider, slack float64, pods ...FiniteLoggingPod) LogChecker
NewFullIngestionPodLogChecker returns a log checks that works with numbered log entries generated by load logging pods and waits until all entries are ingested. If timeout is reached, fraction is lost logs up to slack is considered tolerable.
func NewLogChecker ¶
func NewLogChecker(p LogProvider, pred IngestionPred, timeout TimeoutFun, names ...string) LogChecker
NewLogChecker constructs a LogChecker for a list of names from custom IngestionPred and TimeoutFun.
func NewNumberedLogChecker ¶
func NewNumberedLogChecker(p LogProvider, pred NumberedIngestionPred, timeout NumberedTimeoutFun, names ...string) LogChecker
NewNumberedLogChecker returns a log checker that works with numbered log entries generated by load logging pods.
type LogEntry ¶
type LogEntry struct { LogName string TextPayload string Location string JSONPayload map[string]interface{} }
LogEntry represents a log entry, received from the logging backend.
func (LogEntry) TryGetEntryNumber ¶
TryGetEntryNumber returns the number of the log entry in sequence, if it was generated by the load logging pod (requires special log format).
type LogProvider ¶
type LogProvider interface { Init() error Cleanup() ReadEntries(name string) []LogEntry LoggingAgentName() string }
LogProvider interface provides an API to get logs from the logging backend.
type LoggingPod ¶
type LoggingPod interface { // Name equals to the Kubernetes pod name. Name() string // Start method controls when the logging pod is started in the cluster. Start(f *framework.Framework) error }
LoggingPod is an interface of a pod that can be started and that logs something to its stdout, possibly indefinitely.
func NewExecLoggingPod ¶
func NewExecLoggingPod(podName string, cmd []string) LoggingPod
NewExecLoggingPod returns a logging pod that produces logs through executing a command, passed in cmd.
func NewRepeatingLoggingPod ¶
func NewRepeatingLoggingPod(podName string, line string) LoggingPod
NewRepeatingLoggingPod returns a logging pod that each second prints line value to its stdout.
func StartAndReturnSelf ¶
func StartAndReturnSelf(p LoggingPod, f *framework.Framework) (LoggingPod, error)
StartAndReturnSelf is a helper method to start a logging pod and immediately return it.
type LogsQueueCollection ¶
type LogsQueueCollection interface { Push(name string, logs ...LogEntry) Pop(name string) []LogEntry }
LogsQueueCollection is a thread-safe set of named log queues.
func NewLogsQueueCollection ¶
func NewLogsQueueCollection(queueSize int) LogsQueueCollection
NewLogsQueueCollection returns a new LogsQueueCollection where each queue is created with a default size of queueSize.
type NumberedIngestionPred ¶
NumberedIngestionPred is a IngestionPred that takes into account sequential numbers of ingested entries.
type NumberedTimeoutFun ¶
NumberedTimeoutFun is a TimeoutFun that takes into account sequential numbers of ingested entries.
type TimeoutFun ¶
TimeoutFun is a function that is called when the waiting times out.
var JustTimeout TimeoutFun = func(names []string, ingested []bool) error { failedNames := []string{} for i, name := range names { if !ingested[i] { failedNames = append(failedNames, name) } } return fmt.Errorf("timed out waiting for ingestion, still not ingested: %s", strings.Join(failedNames, ",")) }
JustTimeout returns the error with the list of names for which backend is still still missing logs.