Documentation ¶
Index ¶
- type LogCache
- type LogCacheOption
- func WithAddr(addr string) LogCacheOption
- func WithClustered(nodeIndex int, nodeAddrs []string, opts ...grpc.DialOption) LogCacheOption
- func WithExternalAddr(addr string) LogCacheOption
- func WithLogger(l *log.Logger) LogCacheOption
- func WithMaxPerSource(size int) LogCacheOption
- func WithMemoryLimit(memoryPercent float64) LogCacheOption
- func WithMetrics(m metrics.Initializer) LogCacheOption
- func WithQueryTimeout(queryTimeout time.Duration) LogCacheOption
- func WithServerOpts(opts ...grpc.ServerOption) LogCacheOption
- type MemoryAnalyzer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogCache ¶
type LogCache struct {
// contains filtered or unexported fields
}
LogCache is a in memory cache for Loggregator envelopes.
type LogCacheOption ¶
type LogCacheOption func(*LogCache)
LogCacheOption configures a LogCache.
func WithAddr ¶
func WithAddr(addr string) LogCacheOption
WithAddr configures the address to listen for gRPC requests. It defaults to :8080.
func WithClustered ¶
func WithClustered(nodeIndex int, nodeAddrs []string, opts ...grpc.DialOption) LogCacheOption
WithClustered enables the LogCache to route data to peer nodes. It hashes each envelope by SourceId and routes data that does not belong on the node to the correct node. NodeAddrs is a slice of node addresses where the slice index corresponds to the NodeIndex. The current node's address is included. The default is standalone mode where the LogCache will store all the data and forward none of it.
func WithExternalAddr ¶
func WithExternalAddr(addr string) LogCacheOption
WithExternalAddr returns a LogCacheOption that sets address the scheduler will refer to the given node as. This is required when the set address won't match what the scheduler will refer to the node as (e.g. :0). Defaults to the resulting address from the listener.
func WithLogger ¶
func WithLogger(l *log.Logger) LogCacheOption
WithLogger returns a LogCacheOption that configures the logger used for the LogCache. Defaults to silent logger.
func WithMaxPerSource ¶
func WithMaxPerSource(size int) LogCacheOption
WithMaxPerSource returns a LogCacheOption that configures the store's memory size as number of envelopes for a specific sourceID. Defaults to 100000 envelopes.
func WithMemoryLimit ¶
func WithMemoryLimit(memoryPercent float64) LogCacheOption
WithMemoryLimit sets the percentage of total system memory to use for the cache. If exceeded, the cache will prune. Default is 50%.
func WithMetrics ¶
func WithMetrics(m metrics.Initializer) LogCacheOption
WithMetrics returns a LogCacheOption that configures the metrics for the LogCache. It will add metrics to the given map.
func WithQueryTimeout ¶
func WithQueryTimeout(queryTimeout time.Duration) LogCacheOption
WithQueryTimeout sets the maximum allowed runtime of a single PromQL query. The default is 10s. If you increase this limit, make sure to keep in mind that memory usage will increase with longer durations.
func WithServerOpts ¶
func WithServerOpts(opts ...grpc.ServerOption) LogCacheOption
WithServerOpts configures the gRPC server options. It defaults to an empty list.
type MemoryAnalyzer ¶
MemoryAnalyzer reports the available and total memory.
func NewMemoryAnalyzer ¶
func NewMemoryAnalyzer(metrics metrics.Initializer) *MemoryAnalyzer
NewMemoryAnalyzer creates and returns a new MemoryAnalyzer.
func (*MemoryAnalyzer) Memory ¶
func (a *MemoryAnalyzer) Memory() (heapInUse, available, total uint64)
Memory returns the heap memory and total system memory.