client

package
v0.43.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

This file was copied from the grafana/loki project https://github.com/grafana/loki/blob/v1.6.0/cmd/fluent-bit/buffer.go

Modifications Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved.

Index

Constants

View Source
const (
	MultiTenantClientLabel      = "__gardener_multitenant_id__"
	MultiTenantClientsSeparator = ";"
)

Variables

This section is empty.

Functions

func NewBufferDecorator added in v0.43.0

func NewBufferDecorator(cfg config.Config, newClientFunc NewLokiClientFunc, logger log.Logger) (types.LokiClient, error)

NewBufferDecorator makes a new buffered Client.

func NewClient

func NewClient(cfg config.Config, logger log.Logger, options Options) (types.LokiClient, error)

NewClient creates a new client based on the fluentbit configuration.

func NewMultiTenantClientDecorator added in v0.43.0

func NewMultiTenantClientDecorator(cfg config.Config, newClient NewLokiClientFunc, logger log.Logger) (types.LokiClient, error)

NewMultiTenantClientDecorator returns Loki 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 NewLokiClientFunc, logger log.Logger) (types.LokiClient, error)

NewPackClient return loki client which pack all the labels except the explicitly excluded ones and forward them the the wrapped client.

func NewPromtailClient

func NewPromtailClient(cfg client.Config, logger log.Logger) (types.LokiClient, error)

NewPromtailClient return LokiClient 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 NewLokiClientFunc, logger log.Logger) (types.LokiClient, error)

NewRemoveMultiTenantIdClientDecorator wraps loki 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 NewLokiClientFunc, logger log.Logger) (types.LokiClient, error)

NewRemoveTenantIdClient return loki client which removes the __tenant_id__ value fro the label set

func NewSortedClientDecorator added in v0.43.0

func NewSortedClientDecorator(cfg config.Config, newClient NewLokiClientFunc, logger log.Logger) (types.LokiClient, error)

Types

type Entry added in v0.37.0

type Entry struct {
	Labels model.LabelSet
	logproto.Entry
}

type FakeLokiClient added in v0.37.0

type FakeLokiClient struct {
	IsStopped           bool
	IsGracefullyStopped bool
	Entries             []Entry
}

func (*FakeLokiClient) Handle added in v0.37.0

func (c *FakeLokiClient) Handle(labels model.LabelSet, timestamp time.Time, line string) error

func (*FakeLokiClient) Stop added in v0.37.0

func (c *FakeLokiClient) Stop()

func (*FakeLokiClient) StopWait added in v0.37.0

func (c *FakeLokiClient) StopWait()

type LokiClient added in v0.36.0

type LokiClient interface {
	// Handle processes logs and then sends them to Loki 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()
}

LokiClient represents an instance which sends logs to Loki ingester

type NewLokiClientDecoratorFunc added in v0.43.0

type NewLokiClientDecoratorFunc func(cfg config.Config, client LokiClient, logger log.Logger) (types.LokiClient, error)

NewLokiClientDecoratorFunc return LokiClient which wraps another LokiClient

type NewLokiClientFunc added in v0.43.0

type NewLokiClientFunc func(cfg config.Config, logger log.Logger) (types.LokiClient, error)

NewLokiClientFunc returns a LokiClient on success.

type Options added in v0.43.0

type Options struct {
	RemoveTenantID    bool
	MultiTenantClient bool
	PreservedLabels   model.LabelSet
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL