loki

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestTimeout = 60 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Timestamp string `json:"timestamp"`
	Line      string `json:"line"`
}

Entry is a log line with timestamp.

type Loader

type Loader interface {
	LabelNames(ctx context.Context, start, end time.Time) ([]string, error)
	LabelValues(ctx context.Context, label string, start, end time.Time) ([]string, error)
	QueryRange(ctx context.Context, input QueryRangeInput) (QueryRangeResult, error)
}

Loader defines the interface for querying Loki.

type QueryRangeInput

type QueryRangeInput struct {
	Query     string
	Start     time.Time
	End       time.Time
	Limit     int
	Direction string
}

QueryRangeInput is the query payload for Loki /query_range.

type QueryRangeResult

type QueryRangeResult struct {
	ResultType string   `json:"resultType"`
	Streams    []Stream `json:"streams"`
}

QueryRangeResult is the normalized Loki query_range result.

type RealLoader

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

RealLoader is a real Loki loader implementation.

func NewHTTPLoader added in v0.6.0

func NewHTTPLoader(httpClient *http.Client, baseURL, tenant string) *RealLoader

func (*RealLoader) LabelNames

func (l *RealLoader) LabelNames(ctx context.Context, start, end time.Time) ([]string, error)

func (*RealLoader) LabelValues

func (l *RealLoader) LabelValues(ctx context.Context, label string, start, end time.Time) ([]string, error)

func (*RealLoader) QueryRange

func (l *RealLoader) QueryRange(ctx context.Context, input QueryRangeInput) (QueryRangeResult, error)

type Stream

type Stream struct {
	Labels  map[string]string `json:"labels"`
	Entries []Entry           `json:"entries"`
}

Stream is a Loki stream with labels and entries.

Jump to

Keyboard shortcuts

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