model

package
v1.12.0-community Latest Latest
Warning

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

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

Documentation

Overview

Package model contains data models for Loki-specific types (streams, entries, and label responses).

Index

Constants

View Source
const (
	ResultTypeStream = "streams"
	ResultTypeScalar = "scalar"
	ResultTypeVector = "vector"
	ResultTypeMatrix = "matrix"
)

ResultType values

Variables

This section is empty.

Functions

func AddFlowLineMapping

func AddFlowLineMapping(f FlowLineMapping)

AddFlowLineMapping registers a function that transforms Loki log lines before parsing.

Types

type AggregatedQueryResponse added in v0.1.3

type AggregatedQueryResponse struct {
	ResultType    ResultType      `json:"resultType"`
	Result        ResultValue     `json:"result"`
	Stats         AggregatedStats `json:"stats"`
	UnixTimestamp int64           `json:"unixTimestamp"`
}

AggregatedQueryResponse represents the aggregated json response to one or more storage queries

func (*AggregatedQueryResponse) UnmarshalJSON added in v0.1.3

func (q *AggregatedQueryResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type AggregatedStats added in v0.1.3

type AggregatedStats struct {
	NumQueries   int                    `json:"numQueries"`
	TotalEntries int                    `json:"totalEntries"`
	Duplicates   int                    `json:"duplicates"`
	LimitReached bool                   `json:"limitReached"`
	QueriesStats []interface{}          `json:"queriesStats"`
	DataSources  []constants.DataSource `json:"dataSources"`
}

AggregatedStats represents the stats of one or more storage queries

type Entry added in v0.1.1

type Entry struct {
	Timestamp time.Time
	Line      string
}

Entry represents a Loki log entry. It includes a log message and the time it occurred at.

func (*Entry) MarshalJSON added in v0.1.1

func (e *Entry) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Entry) UnmarshalJSON added in v0.1.1

func (e *Entry) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type FlowLineMapping

type FlowLineMapping = func(string) string

type LabelValuesResponse added in v0.1.2

type LabelValuesResponse struct {
	Status string   `json:"status"`
	Data   []string `json:"data"`
}

LabelValuesResponse represents the http json response to a Loki query for label values

type Matrix added in v0.1.1

type Matrix []model.SampleStream

Matrix is a slice of SampleStreams

func (Matrix) Type added in v0.1.1

func (Matrix) Type() ResultType

Type implements the ResultValue interface

type QueryResponse added in v0.1.1

type QueryResponse struct {
	Status string            `json:"status"`
	Data   QueryResponseData `json:"data"`
}

QueryResponse represents the http json response to a storage query (LogQL or PromQL)

type QueryResponseData added in v0.1.1

type QueryResponseData struct {
	ResultType ResultType  `json:"resultType"`
	Result     ResultValue `json:"result"`
	Stats      interface{} `json:"-"`
}

QueryResponseData represents the http json response data for a storage query

func (*QueryResponseData) UnmarshalJSON added in v0.1.1

func (q *QueryResponseData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ResultType added in v0.1.1

type ResultType string

ResultType holds the type of the result

type ResultValue added in v0.1.1

type ResultValue interface {
	Type() ResultType
}

ResultValue interface mimics the promql.Value interface

type Scalar added in v0.1.1

type Scalar model.Scalar

Scalar is a single timestamp/float with no labels

func (Scalar) MarshalJSON added in v0.1.1

func (s Scalar) MarshalJSON() ([]byte, error)

func (Scalar) Type added in v0.1.1

func (Scalar) Type() ResultType

Type implements the ResultValue interface

func (*Scalar) UnmarshalJSON added in v0.1.1

func (s *Scalar) UnmarshalJSON(b []byte) error

type Stream added in v0.1.1

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

Stream represents a Loki log stream. It includes a set of log entries and their labels.

type Streams added in v0.1.1

type Streams []Stream

Streams is a slice of Stream

func (Streams) Type added in v0.1.1

func (Streams) Type() ResultType

Type implements the ResultValue interface

type Vector added in v0.1.1

type Vector []model.Sample

Vector is a slice of Samples

func (Vector) Type added in v0.1.1

func (Vector) Type() ResultType

Type implements the ResultValue interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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