loki

package
v1.0.952 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFieldMappingConfig = logs.FieldMappingConfig{
	Severity: []string{"detected_level"},
	Host:     []string{"pod"},
}

Functions

func NewSearcher

func NewSearcher(conn connection.Loki, mappingConfig *logs.FieldMappingConfig) *lokiSearcher

Types

type Data

type Data struct {
	ResultType string         `json:"resultType"`
	Stats      map[string]any `json:"stats"`

	// Logs per label (aka. stream)
	Result []Result `json:"result"`
}

Data holds the actual query results and statistics.

type LokiResponse

type LokiResponse struct {
	Status    string       `json:"status"`
	Data      Data         `json:"data"`
	ErrorType v1.ErrorType `json:"errorType,omitempty"`
	Error     string       `json:"error,omitempty"`
}

LokiResponse represents the top-level response from Loki's query_range API.

func (*LokiResponse) ToLogResult

func (t *LokiResponse) ToLogResult(mappingConfig logs.FieldMappingConfig) logs.LogResult

type Request

type Request struct {
	logs.LogsRequestBase `json:",inline" template:"true"`

	// Query is the LogQL query to perform
	Query string `json:"query,omitempty" template:"true"`

	// Since is a duration used to calculate start relative to end.
	// If end is in the future, start is calculated as this duration before now.
	// Any value specified for start supersedes this parameter.
	Since string `json:"since,omitempty"`

	// Step is the Query resolution step width in duration format or float number of seconds
	Step string `json:"step,omitempty"`

	// Only return entries at (or greater than) the specified interval, can be a duration format or float number of seconds
	Interval string `json:"interval,omitempty"`

	// Direction is the direction of the query. "forward" or "backward" (default)
	Direction string `json:"direction,omitempty"`
}

Request represents available parameters for Loki queries.

+kubebuilder:object:generate=true

func (*Request) DeepCopy

func (in *Request) DeepCopy() *Request

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Request.

func (*Request) DeepCopyInto

func (in *Request) DeepCopyInto(out *Request)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Request) Params

func (r *Request) Params() url.Values

Params returns the URL query parameters for the Loki request

type Result

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

Jump to

Keyboard shortcuts

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