loghttp

package
v0.0.0-...-e951c9a Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryStatusSuccess = "success"
	QueryStatusFail    = "fail"
)

QueryStatus values

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

ResultType values

View Source
const (
	VersionLegacy = Version(iota)
	VersionV1
)

Valid Version values

Variables

This section is empty.

Functions

func ParseAndValidateSeriesQuery

func ParseAndValidateSeriesQuery(r *http.Request) (*logproto.SeriesRequest, error)

func ParseLabelQuery

func ParseLabelQuery(r *http.Request) (*logproto.LabelRequest, error)

ParseLabelQuery parses a LabelRequest request from an http request.

func ParseSeriesQuery

func ParseSeriesQuery(r *http.Request) (*logproto.SeriesRequest, error)

func ParseTailQuery

func ParseTailQuery(r *http.Request) (*logproto.TailRequest, error)

ParseTailQuery parses a TailRequest request from an http request.

Types

type DroppedStream

type DroppedStream struct {
	Timestamp time.Time
	Labels    LabelSet
}

DroppedStream represents a dropped stream in tail call

func (*DroppedStream) MarshalJSON

func (s *DroppedStream) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaller

func (*DroppedStream) UnmarshalJSON

func (s *DroppedStream) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.UnMarshaller

type Entry

type Entry struct {
	Timestamp time.Time
	Line      string
}

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

func (*Entry) UnmarshalJSON

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

type InstantQuery

type InstantQuery struct {
	Query     string
	Ts        time.Time
	Limit     uint32
	Direction logproto.Direction
	Shards    []string
}

InstantQuery defines a log instant query.

func ParseInstantQuery

func ParseInstantQuery(r *http.Request) (*InstantQuery, error)

ParseInstantQuery parses an InstantQuery request from an http request.

type LabelResponse

type LabelResponse struct {
	Status string   `json:"status"`
	Data   []string `json:"data,omitempty"`
}

LabelResponse represents the http json response to a label query

type LabelSet

type LabelSet map[string]string

LabelSet is a key/value pair mapping of labels

func (LabelSet) Map

func (l LabelSet) Map() map[string]string

Map coerces LabelSet into a map[string]string. This is useful for working with adapter types.

func (LabelSet) String

func (l LabelSet) String() string

String implements the Stringer interface. It returns a formatted/sorted set of label key/value pairs.

func (*LabelSet) UnmarshalJSON

func (l *LabelSet) UnmarshalJSON(data []byte) error

type Matrix

type Matrix []model.SampleStream

Matrix is a slice of SampleStreams

func (Matrix) Type

func (Matrix) Type() ResultType

Type implements the promql.Value interface

type PushRequest

type PushRequest struct {
	Streams []*Stream `json:"streams"`
}

PushRequest models a log stream push

type QueryResponse

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

QueryResponse represents the http json response to a Loki range and instant query

func (*QueryResponse) UnmarshalJSON

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

type QueryResponseData

type QueryResponseData struct {
	ResultType ResultType   `json:"resultType"`
	Result     ResultValue  `json:"result"`
	Statistics stats.Result `json:"stats"`
}

QueryResponseData represents the http json response to a label query

func (*QueryResponseData) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaler interface.

type QueryStatus

type QueryStatus string

QueryStatus holds the status of a query

type RangeQuery

type RangeQuery struct {
	Start     time.Time
	End       time.Time
	Step      time.Duration
	Interval  time.Duration
	Query     string
	Direction logproto.Direction
	Limit     uint32
	Shards    []string
}

RangeQuery defines a log range query.

func ParseIndexStatsQuery

func ParseIndexStatsQuery(r *http.Request) (*RangeQuery, error)

func ParseRangeQuery

func ParseRangeQuery(r *http.Request) (*RangeQuery, error)

ParseRangeQuery parses a RangeQuery request from an http request.

type ResultType

type ResultType string

ResultType holds the type of the result

type ResultValue

type ResultValue interface {
	Type() ResultType
}

ResultValue interface mimics the promql.Value interface

type Scalar

type Scalar model.Scalar

Scalar is a single timestamp/float with no labels

func (Scalar) MarshalJSON

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

func (Scalar) Type

func (Scalar) Type() ResultType

Type implements the promql.Value interface

func (*Scalar) UnmarshalJSON

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

type SeriesResponse

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

type Stream

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

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

func (*Stream) UnmarshalJSON

func (s *Stream) UnmarshalJSON(data []byte) error

type Streams

type Streams []Stream

Streams is a slice of Stream

func (Streams) ToProto

func (s Streams) ToProto() []logproto.Stream

func (Streams) Type

func (Streams) Type() ResultType

Type implements the promql.Value interface

func (*Streams) UnmarshalJSON

func (ss *Streams) UnmarshalJSON(data []byte) error

type TailResponse

type TailResponse struct {
	Streams        []Stream        `json:"streams,omitempty"`
	DroppedStreams []DroppedStream `json:"dropped_entries,omitempty"`
}

TailResponse represents the http json response to a tail query

type Vector

type Vector []model.Sample

Vector is a slice of Samples

func (Vector) Type

func (Vector) Type() ResultType

Type implements the promql.Value interface

type Version

type Version int

Version holds a loghttp version

func GetVersion

func GetVersion(uri string) Version

GetVersion returns the loghttp version for a given path.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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