Documentation ¶
Overview ¶
This file was copied from the grafana/vali project https://github.com/credativ/vali/blob/v2.2.4/cmd/fluent-bit/buffer.go
Modifications Copyright SAP SE or an SAP affiliate company and Gardener contributors ¶
This file was copied from the grafana/vali project https://github.com/credativ/vali/blob/v2.2.4/cmd/fluent-bit/dque.go
Modifications Copyright SAP SE or an SAP affiliate company and Gardener contributors
Index ¶
- Constants
- type Entry
- type FakeValiClient
- type NewValiClientDecoratorFunc
- type NewValiClientFunc
- type Options
- type ValiClient
- func NewBuffer(cfg config.Config, logger log.Logger, ...) (ValiClient, error)
- func NewBufferDecorator(cfg config.Config, newClientFunc NewValiClientFunc, logger log.Logger) (ValiClient, error)
- func NewClient(cfg config.Config, logger log.Logger, options Options) (ValiClient, error)
- func NewDque(cfg config.Config, logger log.Logger, ...) (ValiClient, error)
- func NewMultiTenantClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
- func NewPackClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
- func NewPromtailClient(cfg client.Config, logger log.Logger) (ValiClient, error)
- func NewRemoveMultiTenantIdClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
- func NewRemoveTenantIdClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
- func NewSortedClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
Constants ¶
const ( // MultiTenantClientLabel is the reserved label for multiple client specification MultiTenantClientLabel = "__gardener_multitenant_id__" // MultiTenantClientsSeparator separates the client names in MultiTenantClientLabel MultiTenantClientsSeparator = ";" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeValiClient ¶ added in v0.53.0
type FakeValiClient struct { // IsStopped show whether the client is stopped or not IsStopped bool // IsGracefullyStopped show whether the client is gracefully topped or not IsGracefullyStopped bool // Entries is slice of all received entries Entries []Entry Mu sync.Mutex }
FakeValiClient mocks ValiClient
func (*FakeValiClient) GetEndPoint ¶ added in v0.55.1
func (c *FakeValiClient) GetEndPoint() string
GetEndPoint returns the target logging backend endpoint
func (*FakeValiClient) Stop ¶ added in v0.53.0
func (c *FakeValiClient) Stop()
Stop stops the client
func (*FakeValiClient) StopWait ¶ added in v0.53.0
func (c *FakeValiClient) StopWait()
StopWait gracefully stops the client
type NewValiClientDecoratorFunc ¶ added in v0.53.0
type NewValiClientDecoratorFunc func(cfg config.Config, client ValiClient, logger log.Logger) (ValiClient, error)
NewValiClientDecoratorFunc return ValiClient which wraps another ValiClient
type NewValiClientFunc ¶ added in v0.53.0
NewValiClientFunc returns a ValiClient on success.
type Options ¶ added in v0.43.0
type Options struct { // RemoveTenantID flag removes the "__tenant_id_" label RemoveTenantID bool // MultiTenantClient glaf removes the "__gardener_multitenant_id__" label MultiTenantClient bool // PreservedLabels is the labels to preserve PreservedLabels model.LabelSet }
Options for creating a Vali client
type ValiClient ¶ added in v0.53.0
type ValiClient interface { // Handle processes logs and then sends them to Vali ingester Handle(labels model.LabelSet, time time.Time, entry string) error // Stop shut down the client immediately without waiting to send the saved logs Stop() // StopWait stops the client of receiving new logs and waits all saved logs to be sent until shuting down StopWait() // GetEndPoint returns the target logging backend endpoint GetEndPoint() string }
ValiClient represents an instance which sends logs to Vali ingester
func NewBuffer ¶ added in v0.55.1
func NewBuffer(cfg config.Config, logger log.Logger, newClientFunc func(cfg config.Config, logger log.Logger) (ValiClient, error)) (ValiClient, error)
NewBuffer makes a new buffered Client.
func NewBufferDecorator ¶ added in v0.43.0
func NewBufferDecorator(cfg config.Config, newClientFunc NewValiClientFunc, logger log.Logger) (ValiClient, error)
NewBufferDecorator makes a new buffered Client.
func NewDque ¶ added in v0.55.1
func NewDque(cfg config.Config, logger log.Logger, newClientFunc func(cfg config.Config, logger log.Logger) (ValiClient, error)) (ValiClient, error)
NewDque makes a new dque vali client
func NewMultiTenantClientDecorator ¶ added in v0.43.0
func NewMultiTenantClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
NewMultiTenantClientDecorator returns Vali client which supports more than one tenant id specified under `_gardener_multitenamt_id__` label. The tenants are separated by semicolon.
func NewPackClientDecorator ¶ added in v0.43.0
func NewPackClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
NewPackClientDecorator return vali client which pack all the labels except the explicitly excluded ones and forward them the the wrapped client.
func NewPromtailClient ¶
NewPromtailClient return ValiClient which wraps the original Promtail client. It increments the ForwardedLogs counter on successful call of the Handle function. !!!This must be the bottom wrapper!!!
func NewRemoveMultiTenantIdClientDecorator ¶ added in v0.43.0
func NewRemoveMultiTenantIdClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
NewRemoveMultiTenantIdClientDecorator wraps vali client which removes the __gardener_multitenant_id__ label from the label set
func NewRemoveTenantIdClientDecorator ¶ added in v0.43.0
func NewRemoveTenantIdClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
NewRemoveTenantIdClientDecorator return vali client which removes the __tenant_id__ value fro the label set
func NewSortedClientDecorator ¶ added in v0.43.0
func NewSortedClientDecorator(cfg config.Config, newClient NewValiClientFunc, logger log.Logger) (ValiClient, error)
NewSortedClientDecorator returns client which sorts the logs based their timestamp.