Documentation ¶
Index ¶
- Constants
- func NewVolumeInstantQueryWithDefaults(matchers string) *logproto.VolumeRequest
- func NewVolumeRangeQueryWithDefaults(matchers string) *logproto.VolumeRequest
- func ParseAndValidateSeriesQuery(r *http.Request) (*logproto.SeriesRequest, error)
- func ParseDetectedFieldsQuery(r *http.Request) (*logproto.DetectedFieldsRequest, error)
- func ParseDetectedLabelsQuery(r *http.Request) (*logproto.DetectedLabelsRequest, error)
- func ParseLabelQuery(r *http.Request) (*logproto.LabelRequest, error)
- func ParsePatternsQuery(r *http.Request) (*logproto.QueryPatternsRequest, error)
- func ParseSeriesQuery(r *http.Request) (*logproto.SeriesRequest, error)
- func ParseTailQuery(r *http.Request) (*logproto.TailRequest, error)
- type DetectedField
- type DetectedFieldsResponse
- type DroppedStream
- type Entry
- type EntryEncoder
- type InstantQuery
- type LabelResponse
- type LabelSet
- type LogProtoStream
- type Matrix
- type PushRequest
- type QueryResponse
- type QueryResponseData
- type QueryStatus
- type RangeQuery
- type ResultType
- type ResultValue
- type Scalar
- type SeriesResponse
- type Stream
- type Streams
- type TailResponse
- type Vector
- type Version
- type VolumeInstantQuery
- type VolumeRangeQuery
Constants ¶
const ( QueryStatusSuccess = "success" QueryStatusFail = "fail" )
QueryStatus values
const ( ResultTypeStream = "streams" ResultTypeScalar = "scalar" ResultTypeVector = "vector" ResultTypeMatrix = "matrix" )
ResultType values
const ( VersionLegacy = Version(iota) VersionV1 )
Valid Version values
Variables ¶
This section is empty.
Functions ¶
func NewVolumeInstantQueryWithDefaults ¶
func NewVolumeInstantQueryWithDefaults(matchers string) *logproto.VolumeRequest
func NewVolumeRangeQueryWithDefaults ¶
func NewVolumeRangeQueryWithDefaults(matchers string) *logproto.VolumeRequest
func ParseAndValidateSeriesQuery ¶
func ParseAndValidateSeriesQuery(r *http.Request) (*logproto.SeriesRequest, error)
func ParseDetectedFieldsQuery ¶
func ParseDetectedFieldsQuery(r *http.Request) (*logproto.DetectedFieldsRequest, error)
func ParseDetectedLabelsQuery ¶
func ParseDetectedLabelsQuery(r *http.Request) (*logproto.DetectedLabelsRequest, error)
func ParseLabelQuery ¶
func ParseLabelQuery(r *http.Request) (*logproto.LabelRequest, error)
ParseLabelQuery parses a LabelRequest request from an http request.
func ParsePatternsQuery ¶
func ParsePatternsQuery(r *http.Request) (*logproto.QueryPatternsRequest, error)
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 DetectedField ¶ added in v3.1.0
type DetectedField struct { Label string `json:"label,omitempty"` Type logproto.DetectedFieldType `json:"type,omitempty"` Cardinality uint64 `json:"cardinality,omitempty"` Parser string `json:"parser,omitempty"` }
type DetectedFieldsResponse ¶ added in v3.1.0
type DetectedFieldsResponse struct { Fields []DetectedField `json:"fields,omitempty"` Values []string `json:"values,omitempty"` }
LabelResponse represents the http json response to a label query
type DroppedStream ¶
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 StructuredMetadata labels.Labels Parsed labels.Labels }
Entry represents a log entry. It includes a log message and the time it occurred at.
func (*Entry) UnmarshalJSON ¶
type EntryEncoder ¶
type EntryEncoder struct{}
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 ¶
LabelResponse represents the http json response to a label query
type LabelSet ¶
LabelSet is a key/value pair mapping of labels
func (LabelSet) Map ¶
Map coerces LabelSet into a map[string]string. This is useful for working with adapter types.
func (LabelSet) String ¶
String implements the Stringer interface. It returns a formatted/sorted set of label key/value pairs.
func (*LabelSet) UnmarshalJSON ¶
type LogProtoStream ¶
LogProtoStream helps with unmarshalling of each log stream for push request. This might look un-necessary but without it the CPU usage in benchmarks was increasing by ~25% :shrug:
func (*LogProtoStream) UnmarshalJSON ¶
func (s *LogProtoStream) UnmarshalJSON(data []byte) error
type PushRequest ¶
type PushRequest struct {
Streams []LogProtoStream `json:"streams"`
}
PushRequest models a log stream push but is unmarshalled to proto push format.
type QueryResponse ¶
type QueryResponse struct { Status string `json:"status"` Warnings []string `json:"warnings,omitempty"` 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 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 NewRangeQueryWithDefaults ¶
func NewRangeQueryWithDefaults() *RangeQuery
func ParseIndexShardsQuery ¶
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.
func (*RangeQuery) UpdateStep ¶
func (q *RangeQuery) UpdateStep()
UpdateStep will adjust the step given new start and end.
type ResultValue ¶
type ResultValue interface {
Type() ResultType
}
ResultValue interface mimics the promql.Value interface
type Scalar ¶
Scalar is a single timestamp/float with no labels
func (Scalar) MarshalJSON ¶
func (*Scalar) UnmarshalJSON ¶
type SeriesResponse ¶
type Stream ¶
Stream represents a log stream. It includes a set of log entries and their labels.
func (*Stream) UnmarshalJSON ¶
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 Version ¶
type Version int
Version holds a loghttp version
func GetVersion ¶
GetVersion returns the loghttp version for a given path.