testloki

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCreationGracePeriod

func WithCreationGracePeriod(d time.Duration) func(config *(map[string]any))

func WithTestLoki

func WithTestLoki(l *TestLoki) pachd.TestPachdOption

func WithoutOldSampleRejection

func WithoutOldSampleRejection(config *(map[string]any))

Types

type Log

type Log struct {
	Time    time.Time
	Message string
	Labels  map[string]string
}

Log is a log entry to add to Loki.

type Option

type Option func(config *map[string]any)

type TestLoki

type TestLoki struct {
	Port   int
	Client *client.Client
	// contains filtered or unexported fields
}

TestLoki is a real Loki instance.

func New

func New(ctx context.Context, tmp string, opts ...Option) (*TestLoki, error)

New starts a new Loki instance on the local machine.

func (*TestLoki) AddLog

func (l *TestLoki) AddLog(ctx context.Context, lg *Log) (retErr error)

AddLog adds a log line to Loki.

func (*TestLoki) Close

func (l *TestLoki) Close() error

Close kills the running Loki.

func (*TestLoki) WithLoki

func (l *TestLoki) WithLoki(sendCtx context.Context, lokiLabels map[string]string) pctx.Option

WithLoki returns a pctx context option that will send logs to this Loki instance.

Jump to

Keyboard shortcuts

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