Help us shape the future of Go! Take the 2026 Go Developer Survey

loki

package
v1.4.30 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package loki provides bounded, scoped read-only Loki queries for interactive tools.

Index

Constants

View Source
const MaximumLimit = 100
View Source
const MaximumOffset = 1000

Variables

View Source
var ErrInvalidArgument = errors.New("loki: invalid argument")
View Source
var ErrInvalidConfig = errors.New("loki: invalid configuration")
View Source
var ErrResponseTooLarge = errors.New("loki: response too large")
View Source
var ErrUnsupportedScope = errors.New("loki: configured query is not a selector-only scope")

Functions

This section is empty.

Types

type DiscoveryRequest

type DiscoveryRequest struct {
	Label, Search string
	Offset, Limit int
}

type DiscoveryResult

type DiscoveryResult struct {
	Labels     []string `json:"labels"`
	Count      int      `json:"count"`
	Offset     int      `json:"offset"`
	Limit      int      `json:"limit"`
	NextOffset int      `json:"next_offset,omitempty"`
	Truncated  bool     `json:"truncated"`
	Truncation []string `json:"truncation,omitempty"`
}

type Policy

type Policy struct {
	MaxRows, MaxFields, MaxBytes int
	MaxLookback, Timeout         time.Duration
}

func ToolPolicy

func ToolPolicy() Policy

type ReadRequest

type ReadRequest struct {
	Labels          map[string]string
	Service, Search string
	Lookback        time.Duration
	Offset, Limit   int
}

type ReadResult

type ReadResult struct {
	Records    []Record `json:"records"`
	Count      int      `json:"count"`
	Offset     int      `json:"offset"`
	Limit      int      `json:"limit"`
	NextOffset int      `json:"next_offset,omitempty"`
	Truncated  bool     `json:"truncated"`
	Truncation []string `json:"truncation,omitempty"`
}

type Record

type Record struct {
	Timestamp time.Time         `json:"timestamp"`
	Message   string            `json:"message"`
	Labels    map[string]string `json:"labels"`
}

type Service

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

func NewService

func NewService(cfg config.AgentLokiSourceConfig, scrubber core.Scrubber) (*Service, error)

NewService constructs an isolated read transport; it does not change the ingestion client.

func (*Service) Discover

func (service *Service) Discover(ctx context.Context, request DiscoveryRequest) (DiscoveryResult, error)

func (*Service) DiscoveryAvailable

func (service *Service) DiscoveryAvailable() bool

DiscoveryAvailable is true when scope can be enforced by the series endpoint.

func (*Service) Read

func (service *Service) Read(ctx context.Context, request ReadRequest) (ReadResult, error)

Jump to

Keyboard shortcuts

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