loki

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff struct {

	// Factor is the multiplying factor for each increment step
	Factor float64
	// Jitter eases contention by randomizing backoff steps
	Jitter bool
	// Min and Max are the minimum and maximum values of the counter
	Min, Max time.Duration
	// contains filtered or unexported fields
}

Backoff is a time.Duration counter, starting at Min. After every call to the Duration method the current timing is multiplied by Factor, but it never exceeds Max.

Backoff is not generally concurrent-safe, but the ForAttempt method can be used concurrently.

func (*Backoff) Attempt

func (b *Backoff) Attempt() float64

Attempt returns the current attempt counter value.

func (*Backoff) Copy

func (b *Backoff) Copy() *Backoff

Copy returns a backoff with equals constraints as the original

func (*Backoff) Duration

func (b *Backoff) Duration() time.Duration

Duration returns the duration for the current attempt before incrementing the attempt counter. See ForAttempt.

func (*Backoff) ForAttempt

func (b *Backoff) ForAttempt(attempt float64) time.Duration

ForAttempt returns the duration for a specific attempt. This is useful if you have a large number of independent Backoffs, but don't want use unnecessary memory storing the Backoff parameters per Backoff. The first attempt should be 0.

ForAttempt is concurrent-safe.

func (*Backoff) Reset

func (b *Backoff) Reset()

Reset restarts the current attempt counter at zero.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for Loki

func NewClient

func NewClient(cfg Config) *Client

NewClient create new Loki client

func (*Client) Send

func (c *Client) Send(streams []*logproto.Stream) (err error)

Send streams to Loki instance

type Config

type Config struct {
	URL     string
	Timeout time.Duration
}

Config for Loki client

type Output added in v1.4.0

type Output struct {
	URL           string          `toml:"url"`
	Timeout       config.Duration `toml:"timeout"`
	BatchSize     int             `toml:"batch_size"`
	BatchInterval config.Duration `toml:"batch_interval"`
	// contains filtered or unexported fields
}

Output for Loki

func (*Output) Close added in v1.4.0

func (o *Output) Close() error

Close the output writer

func (*Output) Connect added in v1.4.0

func (o *Output) Connect() error

Connect activate the Loki writer

func (*Output) Description added in v1.4.0

func (o *Output) Description() string

Description get output description

func (*Output) SendEvent added in v1.4.0

func (o *Output) SendEvent(event events.Event) error

SendEvent send event to the Output

func (*Output) SetCondition added in v1.4.0

func (o *Output) SetCondition(condition conditional.Expression)

SetCondition set condition expression

func (*Output) SetSerializer added in v1.4.0

func (o *Output) SetSerializer(serializer serializers.Serializer)

SetSerializer set data serializer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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