lokiclient

package
v0.0.0-release-12.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClampRange

func ClampRange(start, end, maxTimeRange int64) (newStart int64, newEnd int64)

ClampRange ensures that the time range is within the configured maximum query length.

func NewRequester

func NewRequester() alertingInstrument.Requester

Types

type HTTPLokiClient

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

func NewLokiClient

func NewLokiClient(cfg LokiConfig, req alertingInstrument.Requester, bytesWritten prometheus.Counter, writeDuration *instrument.HistogramCollector, logger log.Logger, tracer trace.Tracer, spanName string) *HTTPLokiClient

func (*HTTPLokiClient) MaxQuerySize

func (c *HTTPLokiClient) MaxQuerySize() int

func (*HTTPLokiClient) Ping

func (c *HTTPLokiClient) Ping(ctx context.Context) error

func (*HTTPLokiClient) Push

func (c *HTTPLokiClient) Push(ctx context.Context, s []Stream) error

func (*HTTPLokiClient) RangeQuery

func (c *HTTPLokiClient) RangeQuery(ctx context.Context, logQL string, start, end, limit int64) (QueryRes, error)

type JSONEncoder

type JSONEncoder struct{}

type LokiConfig

type LokiConfig struct {
	ReadPathURL       *url.URL
	WritePathURL      *url.URL
	BasicAuthUser     string
	BasicAuthPassword string
	TenantID          string
	ExternalLabels    map[string]string
	Encoder           encoder
	MaxQueryLength    time.Duration
	MaxQuerySize      int
}

type Operator

type Operator string

Kind of Operation (=, !=, =~, !~)

const (
	// Equal operator (=)
	Eq Operator = "="
	// Not Equal operator (!=)
	Neq Operator = "!="
	// Equal operator supporting RegEx (=~)
	EqRegEx Operator = "=~"
	// Not Equal operator supporting RegEx (!~)
	NeqRegEx Operator = "!~"
)

type QueryData

type QueryData struct {
	Result []Stream `json:"result"`
}

type QueryRes

type QueryRes struct {
	Data QueryData `json:"data"`
}

type Sample

type Sample struct {
	T time.Time
	V string
}

func (*Sample) MarshalJSON

func (r *Sample) MarshalJSON() ([]byte, error)

func (*Sample) UnmarshalJSON

func (r *Sample) UnmarshalJSON(b []byte) error

type SnappyProtoEncoder

type SnappyProtoEncoder struct{}

type Stream

type Stream struct {
	Stream map[string]string `json:"stream"`
	Values []Sample          `json:"values"`
}

Jump to

Keyboard shortcuts

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