lokiapi

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) LabelValues

func (c *Client) LabelValues(ctx context.Context, params LabelValuesParams) (*Values, error)

LabelValues invokes labelValues operation.

Get values of label.

GET /loki/api/v1/label/{name}/values

func (*Client) Labels

func (c *Client) Labels(ctx context.Context, params LabelsParams) (*Labels, error)

Labels invokes labels operation.

Get labels. Used by Grafana to test connection to Loki.

GET /loki/api/v1/labels

func (*Client) Push

func (c *Client) Push(ctx context.Context, request PushReq) error

Push invokes push operation.

Push data.

POST /loki/api/v1/push

func (*Client) Query

func (c *Client) Query(ctx context.Context, params QueryParams) (*QueryResponse, error)

Query invokes query operation.

Query.

GET /loki/api/v1/query

func (*Client) QueryRange

func (c *Client) QueryRange(ctx context.Context, params QueryRangeParams) (*QueryResponse, error)

QueryRange invokes queryRange operation.

Query range.

GET /loki/api/v1/query_range

func (*Client) Series

func (c *Client) Series(ctx context.Context, params SeriesParams) (*Maps, error)

Series invokes series operation.

Get series.

GET /loki/api/v1/series

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type Direction

type Direction string

Ref: #/components/schemas/Direction

const (
	DirectionBackward Direction = "backward"
	DirectionForward  Direction = "forward"
)

func (Direction) MarshalText

func (s Direction) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Direction) UnmarshalText

func (s *Direction) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Direction) Validate

func (s Direction) Validate() error

type Error

type Error string

func (*Error) Decode

func (s *Error) Decode(d *jx.Decoder) error

Decode decodes Error from json.

func (Error) Encode

func (s Error) Encode(e *jx.Encoder)

Encode encodes Error as json.

func (Error) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Error) SetFake

func (s *Error) SetFake()

SetFake set fake values.

func (*Error) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   Error
}

ErrorStatusCode wraps Error with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() Error

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val Error)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type Handler

type Handler interface {
	// LabelValues implements labelValues operation.
	//
	// Get values of label.
	//
	// GET /loki/api/v1/label/{name}/values
	LabelValues(ctx context.Context, params LabelValuesParams) (*Values, error)
	// Labels implements labels operation.
	//
	// Get labels.
	// Used by Grafana to test connection to Loki.
	//
	// GET /loki/api/v1/labels
	Labels(ctx context.Context, params LabelsParams) (*Labels, error)
	// Push implements push operation.
	//
	// Push data.
	//
	// POST /loki/api/v1/push
	Push(ctx context.Context, req PushReq) error
	// Query implements query operation.
	//
	// Query.
	//
	// GET /loki/api/v1/query
	Query(ctx context.Context, params QueryParams) (*QueryResponse, error)
	// QueryRange implements queryRange operation.
	//
	// Query range.
	//
	// GET /loki/api/v1/query_range
	QueryRange(ctx context.Context, params QueryRangeParams) (*QueryResponse, error)
	// Series implements series operation.
	//
	// Get series.
	//
	// GET /loki/api/v1/series
	Series(ctx context.Context, params SeriesParams) (*Maps, error)
	// NewError creates *ErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type LabelSet

type LabelSet map[string]string

Ref: #/components/schemas/LabelSet

func (*LabelSet) Decode

func (s *LabelSet) Decode(d *jx.Decoder) error

Decode decodes LabelSet from json.

func (LabelSet) Encode

func (s LabelSet) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (LabelSet) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*LabelSet) SetFake

func (s *LabelSet) SetFake()

SetFake set fake values.

func (*LabelSet) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type LabelValuesParams

type LabelValuesParams struct {
	// Grafana username that is passed to datasource when making requests from Grafana. Used for
	// authentication and authorization.
	XGrafanaUser OptString
	// The start time for the query as a nanosecond Unix epoch.
	// Defaults to 6 hours ago.
	Start OptLokiTime
	// The end time for the query as a nanosecond Unix epoch.
	// Defaults to now.
	End OptLokiTime
	// 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 OptPrometheusDuration
	// A set of log stream selector that selects the streams to match and return label values for
	// `{name}`.
	Query OptString
	// Label name.
	Name string
}

LabelValuesParams is parameters of labelValues operation.

type Labels

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

Array of label names. Ref: #/components/schemas/Labels

func (*Labels) Decode

func (s *Labels) Decode(d *jx.Decoder) error

Decode decodes Labels from json.

func (*Labels) Encode

func (s *Labels) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Labels) GetData

func (s *Labels) GetData() []string

GetData returns the value of Data.

func (*Labels) GetStatus

func (s *Labels) GetStatus() string

GetStatus returns the value of Status.

func (*Labels) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Labels) SetData

func (s *Labels) SetData(val []string)

SetData sets the value of Data.

func (*Labels) SetFake

func (s *Labels) SetFake()

SetFake set fake values.

func (*Labels) SetStatus

func (s *Labels) SetStatus(val string)

SetStatus sets the value of Status.

func (*Labels) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Labels) Validate

func (s *Labels) Validate() error

type LabelsParams

type LabelsParams struct {
	// Grafana username that is passed to datasource when making requests from Grafana. Used for
	// authentication and authorization.
	XGrafanaUser OptString
	// The start time for the query as a nanosecond Unix epoch.
	// Defaults to 6 hours ago.
	Start OptLokiTime
	// The end time for the query as a nanosecond Unix epoch.
	// Defaults to now.
	End OptLokiTime
	// 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 OptPrometheusDuration
}

LabelsParams is parameters of labels operation.

type LogEntry

type LogEntry struct {
	T uint64
	V string
}

Ref: #/components/schemas/LogEntry

func (*LogEntry) Decode

func (s *LogEntry) Decode(d *jx.Decoder) error

Decode decodes LogEntry from json.

func (*LogEntry) Encode

func (s *LogEntry) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*LogEntry) GetT

func (s *LogEntry) GetT() uint64

GetT returns the value of T.

func (*LogEntry) GetV

func (s *LogEntry) GetV() string

GetV returns the value of V.

func (*LogEntry) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*LogEntry) SetFake

func (s *LogEntry) SetFake()

SetFake set fake values.

func (*LogEntry) SetT

func (s *LogEntry) SetT(val uint64)

SetT sets the value of T.

func (*LogEntry) SetV

func (s *LogEntry) SetV(val string)

SetV sets the value of V.

func (*LogEntry) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type LokiTime

type LokiTime string

type Maps

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

Array of maps. Ref: #/components/schemas/Maps

func (*Maps) Decode

func (s *Maps) Decode(d *jx.Decoder) error

Decode decodes Maps from json.

func (*Maps) Encode

func (s *Maps) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Maps) GetData

func (s *Maps) GetData() []MapsDataItem

GetData returns the value of Data.

func (*Maps) GetStatus

func (s *Maps) GetStatus() string

GetStatus returns the value of Status.

func (*Maps) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Maps) SetData

func (s *Maps) SetData(val []MapsDataItem)

SetData sets the value of Data.

func (*Maps) SetFake

func (s *Maps) SetFake()

SetFake set fake values.

func (*Maps) SetStatus

func (s *Maps) SetStatus(val string)

SetStatus sets the value of Status.

func (*Maps) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Maps) Validate

func (s *Maps) Validate() error

type MapsDataItem

type MapsDataItem map[string]string

func (*MapsDataItem) Decode

func (s *MapsDataItem) Decode(d *jx.Decoder) error

Decode decodes MapsDataItem from json.

func (MapsDataItem) Encode

func (s MapsDataItem) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (MapsDataItem) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*MapsDataItem) SetFake

func (s *MapsDataItem) SetFake()

SetFake set fake values.

func (*MapsDataItem) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type Matrix

type Matrix []Series

func (*Matrix) Decode

func (s *Matrix) Decode(d *jx.Decoder) error

Decode decodes Matrix from json.

func (Matrix) Encode

func (s Matrix) Encode(e *jx.Encoder)

Encode encodes Matrix as json.

func (Matrix) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Matrix) SetFake

func (s *Matrix) SetFake()

SetFake set fake values.

func (*Matrix) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (Matrix) Validate

func (s Matrix) Validate() error

type MatrixResult

type MatrixResult struct {
	Result Matrix `json:"result"`
	Stats  *Stats `json:"stats"`
}

Ref: #/components/schemas/MatrixResult

func (*MatrixResult) Decode

func (s *MatrixResult) Decode(d *jx.Decoder) error

Decode decodes MatrixResult from json.

func (*MatrixResult) Encode

func (s *MatrixResult) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*MatrixResult) GetResult

func (s *MatrixResult) GetResult() Matrix

GetResult returns the value of Result.

func (*MatrixResult) GetStats

func (s *MatrixResult) GetStats() *Stats

GetStats returns the value of Stats.

func (*MatrixResult) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*MatrixResult) SetFake

func (s *MatrixResult) SetFake()

SetFake set fake values.

func (*MatrixResult) SetResult

func (s *MatrixResult) SetResult(val Matrix)

SetResult sets the value of Result.

func (*MatrixResult) SetStats

func (s *MatrixResult) SetStats(val *Stats)

SetStats sets the value of Stats.

func (*MatrixResult) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*MatrixResult) Validate

func (s *MatrixResult) Validate() error

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OptDirection

type OptDirection struct {
	Value Direction
	Set   bool
}

OptDirection is optional Direction.

func NewOptDirection

func NewOptDirection(v Direction) OptDirection

NewOptDirection returns new OptDirection with value set to v.

func (OptDirection) Get

func (o OptDirection) Get() (v Direction, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptDirection) IsSet

func (o OptDirection) IsSet() bool

IsSet returns true if OptDirection was set.

func (OptDirection) Or

Or returns value if set, or given parameter if does not.

func (*OptDirection) Reset

func (o *OptDirection) Reset()

Reset unsets value.

func (*OptDirection) SetTo

func (o *OptDirection) SetTo(v Direction)

SetTo sets value to v.

type OptInt

type OptInt struct {
	Value int
	Set   bool
}

OptInt is optional int.

func NewOptInt

func NewOptInt(v int) OptInt

NewOptInt returns new OptInt with value set to v.

func (OptInt) Get

func (o OptInt) Get() (v int, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptInt) IsSet

func (o OptInt) IsSet() bool

IsSet returns true if OptInt was set.

func (OptInt) Or

func (o OptInt) Or(d int) int

Or returns value if set, or given parameter if does not.

func (*OptInt) Reset

func (o *OptInt) Reset()

Reset unsets value.

func (*OptInt) SetTo

func (o *OptInt) SetTo(v int)

SetTo sets value to v.

type OptLabelSet

type OptLabelSet struct {
	Value LabelSet
	Set   bool
}

OptLabelSet is optional LabelSet.

func NewOptLabelSet

func NewOptLabelSet(v LabelSet) OptLabelSet

NewOptLabelSet returns new OptLabelSet with value set to v.

func (*OptLabelSet) Decode

func (o *OptLabelSet) Decode(d *jx.Decoder) error

Decode decodes LabelSet from json.

func (OptLabelSet) Encode

func (o OptLabelSet) Encode(e *jx.Encoder)

Encode encodes LabelSet as json.

func (OptLabelSet) Get

func (o OptLabelSet) Get() (v LabelSet, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptLabelSet) IsSet

func (o OptLabelSet) IsSet() bool

IsSet returns true if OptLabelSet was set.

func (OptLabelSet) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptLabelSet) Or

func (o OptLabelSet) Or(d LabelSet) LabelSet

Or returns value if set, or given parameter if does not.

func (*OptLabelSet) Reset

func (o *OptLabelSet) Reset()

Reset unsets value.

func (*OptLabelSet) SetFake

func (s *OptLabelSet) SetFake()

SetFake set fake values.

func (*OptLabelSet) SetTo

func (o *OptLabelSet) SetTo(v LabelSet)

SetTo sets value to v.

func (*OptLabelSet) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptLokiTime

type OptLokiTime struct {
	Value LokiTime
	Set   bool
}

OptLokiTime is optional LokiTime.

func NewOptLokiTime

func NewOptLokiTime(v LokiTime) OptLokiTime

NewOptLokiTime returns new OptLokiTime with value set to v.

func (OptLokiTime) Get

func (o OptLokiTime) Get() (v LokiTime, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptLokiTime) IsSet

func (o OptLokiTime) IsSet() bool

IsSet returns true if OptLokiTime was set.

func (OptLokiTime) Or

func (o OptLokiTime) Or(d LokiTime) LokiTime

Or returns value if set, or given parameter if does not.

func (*OptLokiTime) Reset

func (o *OptLokiTime) Reset()

Reset unsets value.

func (*OptLokiTime) SetTo

func (o *OptLokiTime) SetTo(v LokiTime)

SetTo sets value to v.

type OptPrometheusDuration

type OptPrometheusDuration struct {
	Value PrometheusDuration
	Set   bool
}

OptPrometheusDuration is optional PrometheusDuration.

func NewOptPrometheusDuration

func NewOptPrometheusDuration(v PrometheusDuration) OptPrometheusDuration

NewOptPrometheusDuration returns new OptPrometheusDuration with value set to v.

func (OptPrometheusDuration) Get

Get returns value and boolean that denotes whether value was set.

func (OptPrometheusDuration) IsSet

func (o OptPrometheusDuration) IsSet() bool

IsSet returns true if OptPrometheusDuration was set.

func (OptPrometheusDuration) Or

Or returns value if set, or given parameter if does not.

func (*OptPrometheusDuration) Reset

func (o *OptPrometheusDuration) Reset()

Reset unsets value.

func (*OptPrometheusDuration) SetTo

SetTo sets value to v.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type PrometheusDuration

type PrometheusDuration string

func (PrometheusDuration) Validate

func (s PrometheusDuration) Validate() error

type PrometheusSamplePair

type PrometheusSamplePair struct {
	T float64
	V string
}

Ref: #/components/schemas/PrometheusSamplePair

func (*PrometheusSamplePair) Decode

func (s *PrometheusSamplePair) Decode(d *jx.Decoder) error

Decode decodes PrometheusSamplePair from json.

func (*PrometheusSamplePair) Encode

func (s *PrometheusSamplePair) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PrometheusSamplePair) GetT

func (s *PrometheusSamplePair) GetT() float64

GetT returns the value of T.

func (*PrometheusSamplePair) GetV

func (s *PrometheusSamplePair) GetV() string

GetV returns the value of V.

func (*PrometheusSamplePair) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*PrometheusSamplePair) SetFake

func (s *PrometheusSamplePair) SetFake()

SetFake set fake values.

func (*PrometheusSamplePair) SetT

func (s *PrometheusSamplePair) SetT(val float64)

SetT sets the value of T.

func (*PrometheusSamplePair) SetV

func (s *PrometheusSamplePair) SetV(val string)

SetV sets the value of V.

func (*PrometheusSamplePair) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PrometheusSamplePair) Validate

func (s *PrometheusSamplePair) Validate() error

type Push

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

Ref: #/components/schemas/Push

func (*Push) Decode

func (s *Push) Decode(d *jx.Decoder) error

Decode decodes Push from json.

func (*Push) Encode

func (s *Push) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Push) GetStreams

func (s *Push) GetStreams() []Stream

GetStreams returns the value of Streams.

func (*Push) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Push) SetFake

func (s *Push) SetFake()

SetFake set fake values.

func (*Push) SetStreams

func (s *Push) SetStreams(val []Stream)

SetStreams sets the value of Streams.

func (*Push) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Push) Validate

func (s *Push) Validate() error

type PushNoContent

type PushNoContent struct{}

PushNoContent is response for Push operation.

type PushReq

type PushReq interface {
	// contains filtered or unexported methods
}

type PushReqApplicationXProtobuf

type PushReqApplicationXProtobuf struct {
	Data io.Reader
}

func (PushReqApplicationXProtobuf) Read

func (s PushReqApplicationXProtobuf) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type QueryParams

type QueryParams struct {
	// Grafana username that is passed to datasource when making requests from Grafana. Used for
	// authentication and authorization.
	XGrafanaUser OptString
	// The LogQL query to perform.
	Query string
	// The max number of entries to return.
	// It defaults to `100`.
	// Only applies to query types which produce a stream (log lines) response.
	Limit OptInt
	// The evaluation time for the query as a nanosecond Unix epoch or another supported format.
	// Defaults to now.
	Time OptLokiTime
	// Determines the sort order of logs.
	// Supported values are `forward` or `backward`.
	// Defaults to `backward`.
	Direction OptDirection
}

QueryParams is parameters of query operation.

type QueryRangeParams

type QueryRangeParams struct {
	// Grafana username that is passed to datasource when making requests from Grafana. Used for
	// authentication and authorization.
	XGrafanaUser OptString
	Start        OptLokiTime
	End          OptLokiTime
	// 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 OptPrometheusDuration
	// The LogQL query to perform.
	Query string
	// Query resolution step width in `duration` format or float number of seconds.
	// `duration` refers to Prometheus duration strings of the form `[0-9]+[smhdwy]`.
	// For example, `5m` refers to a duration of 5 minutes.
	// Defaults to a dynamic value based on start and end.
	// Only applies to query types which produce a matrix response.
	Step OptPrometheusDuration
	// The max number of entries to return.
	// It defaults to `100`.
	// Only applies to query types which produce a stream (log lines) response.
	Limit OptInt
	// Determines the sort order of logs.
	// Supported values are `forward` or `backward`.
	// Defaults to `backward`.
	Direction OptDirection
}

QueryRangeParams is parameters of queryRange operation.

type QueryResponse

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

Ref: #/components/schemas/QueryResponse

func (*QueryResponse) Decode

func (s *QueryResponse) Decode(d *jx.Decoder) error

Decode decodes QueryResponse from json.

func (*QueryResponse) Encode

func (s *QueryResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*QueryResponse) GetData

func (s *QueryResponse) GetData() QueryResponseData

GetData returns the value of Data.

func (*QueryResponse) GetStatus

func (s *QueryResponse) GetStatus() string

GetStatus returns the value of Status.

func (*QueryResponse) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*QueryResponse) SetData

func (s *QueryResponse) SetData(val QueryResponseData)

SetData sets the value of Data.

func (*QueryResponse) SetFake

func (s *QueryResponse) SetFake()

SetFake set fake values.

func (*QueryResponse) SetStatus

func (s *QueryResponse) SetStatus(val string)

SetStatus sets the value of Status.

func (*QueryResponse) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*QueryResponse) Validate

func (s *QueryResponse) Validate() error

type QueryResponseData

type QueryResponseData struct {
	Type          QueryResponseDataType // switch on this field
	StreamsResult StreamsResult
	ScalarResult  ScalarResult
	VectorResult  VectorResult
	MatrixResult  MatrixResult
}

Ref: #/components/schemas/QueryResponseData QueryResponseData represents sum type.

func NewMatrixResultQueryResponseData

func NewMatrixResultQueryResponseData(v MatrixResult) QueryResponseData

NewMatrixResultQueryResponseData returns new QueryResponseData from MatrixResult.

func NewScalarResultQueryResponseData

func NewScalarResultQueryResponseData(v ScalarResult) QueryResponseData

NewScalarResultQueryResponseData returns new QueryResponseData from ScalarResult.

func NewStreamsResultQueryResponseData

func NewStreamsResultQueryResponseData(v StreamsResult) QueryResponseData

NewStreamsResultQueryResponseData returns new QueryResponseData from StreamsResult.

func NewVectorResultQueryResponseData

func NewVectorResultQueryResponseData(v VectorResult) QueryResponseData

NewVectorResultQueryResponseData returns new QueryResponseData from VectorResult.

func (*QueryResponseData) Decode

func (s *QueryResponseData) Decode(d *jx.Decoder) error

Decode decodes QueryResponseData from json.

func (QueryResponseData) Encode

func (s QueryResponseData) Encode(e *jx.Encoder)

Encode encodes QueryResponseData as json.

func (QueryResponseData) GetMatrixResult

func (s QueryResponseData) GetMatrixResult() (v MatrixResult, ok bool)

GetMatrixResult returns MatrixResult and true boolean if QueryResponseData is MatrixResult.

func (QueryResponseData) GetScalarResult

func (s QueryResponseData) GetScalarResult() (v ScalarResult, ok bool)

GetScalarResult returns ScalarResult and true boolean if QueryResponseData is ScalarResult.

func (QueryResponseData) GetStreamsResult

func (s QueryResponseData) GetStreamsResult() (v StreamsResult, ok bool)

GetStreamsResult returns StreamsResult and true boolean if QueryResponseData is StreamsResult.

func (QueryResponseData) GetVectorResult

func (s QueryResponseData) GetVectorResult() (v VectorResult, ok bool)

GetVectorResult returns VectorResult and true boolean if QueryResponseData is VectorResult.

func (QueryResponseData) IsMatrixResult

func (s QueryResponseData) IsMatrixResult() bool

IsMatrixResult reports whether QueryResponseData is MatrixResult.

func (QueryResponseData) IsScalarResult

func (s QueryResponseData) IsScalarResult() bool

IsScalarResult reports whether QueryResponseData is ScalarResult.

func (QueryResponseData) IsStreamsResult

func (s QueryResponseData) IsStreamsResult() bool

IsStreamsResult reports whether QueryResponseData is StreamsResult.

func (QueryResponseData) IsVectorResult

func (s QueryResponseData) IsVectorResult() bool

IsVectorResult reports whether QueryResponseData is VectorResult.

func (QueryResponseData) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*QueryResponseData) SetFake

func (s *QueryResponseData) SetFake()

SetFake set fake values.

func (*QueryResponseData) SetMatrixResult

func (s *QueryResponseData) SetMatrixResult(v MatrixResult)

SetMatrixResult sets QueryResponseData to MatrixResult.

func (*QueryResponseData) SetScalarResult

func (s *QueryResponseData) SetScalarResult(v ScalarResult)

SetScalarResult sets QueryResponseData to ScalarResult.

func (*QueryResponseData) SetStreamsResult

func (s *QueryResponseData) SetStreamsResult(v StreamsResult)

SetStreamsResult sets QueryResponseData to StreamsResult.

func (*QueryResponseData) SetVectorResult

func (s *QueryResponseData) SetVectorResult(v VectorResult)

SetVectorResult sets QueryResponseData to VectorResult.

func (*QueryResponseData) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (QueryResponseData) Validate

func (s QueryResponseData) Validate() error

type QueryResponseDataType

type QueryResponseDataType string

QueryResponseDataType is oneOf type of QueryResponseData.

const (
	StreamsResultQueryResponseData QueryResponseDataType = "StreamsResult"
	ScalarResultQueryResponseData  QueryResponseDataType = "ScalarResult"
	VectorResultQueryResponseData  QueryResponseDataType = "VectorResult"
	MatrixResultQueryResponseData  QueryResponseDataType = "MatrixResult"
)

Possible values for QueryResponseDataType.

type Route

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

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

type ScalarResult

type ScalarResult struct {
	Result PrometheusSamplePair `json:"result"`
	Stats  *Stats               `json:"stats"`
}

Ref: #/components/schemas/ScalarResult

func (*ScalarResult) Decode

func (s *ScalarResult) Decode(d *jx.Decoder) error

Decode decodes ScalarResult from json.

func (*ScalarResult) Encode

func (s *ScalarResult) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ScalarResult) GetResult

func (s *ScalarResult) GetResult() PrometheusSamplePair

GetResult returns the value of Result.

func (*ScalarResult) GetStats

func (s *ScalarResult) GetStats() *Stats

GetStats returns the value of Stats.

func (*ScalarResult) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ScalarResult) SetFake

func (s *ScalarResult) SetFake()

SetFake set fake values.

func (*ScalarResult) SetResult

func (s *ScalarResult) SetResult(val PrometheusSamplePair)

SetResult sets the value of Result.

func (*ScalarResult) SetStats

func (s *ScalarResult) SetStats(val *Stats)

SetStats sets the value of Stats.

func (*ScalarResult) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ScalarResult) Validate

func (s *ScalarResult) Validate() error

type Series

type Series struct {
	Metric OptLabelSet            `json:"metric"`
	Values []PrometheusSamplePair `json:"values"`
}

Ref: #/components/schemas/Series

func (*Series) Decode

func (s *Series) Decode(d *jx.Decoder) error

Decode decodes Series from json.

func (*Series) Encode

func (s *Series) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Series) GetMetric

func (s *Series) GetMetric() OptLabelSet

GetMetric returns the value of Metric.

func (*Series) GetValues

func (s *Series) GetValues() []PrometheusSamplePair

GetValues returns the value of Values.

func (*Series) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Series) SetFake

func (s *Series) SetFake()

SetFake set fake values.

func (*Series) SetMetric

func (s *Series) SetMetric(val OptLabelSet)

SetMetric sets the value of Metric.

func (*Series) SetValues

func (s *Series) SetValues(val []PrometheusSamplePair)

SetValues sets the value of Values.

func (*Series) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Series) Validate

func (s *Series) Validate() error

type SeriesParams

type SeriesParams struct {
	Start OptLokiTime
	End   OptLokiTime
	// 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 OptPrometheusDuration
	Match []string
}

SeriesParams is parameters of series operation.

type Server

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

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type Stats

type Stats struct{}

Ref: #/components/schemas/Stats

func (*Stats) Decode

func (s *Stats) Decode(d *jx.Decoder) error

Decode decodes Stats from json.

func (*Stats) Encode

func (s *Stats) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Stats) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Stats) SetFake

func (s *Stats) SetFake()

SetFake set fake values.

func (*Stats) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type Stream

type Stream struct {
	Stream OptLabelSet `json:"stream"`
	Values []LogEntry  `json:"values"`
}

Ref: #/components/schemas/Stream

func (*Stream) Decode

func (s *Stream) Decode(d *jx.Decoder) error

Decode decodes Stream from json.

func (*Stream) Encode

func (s *Stream) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Stream) GetStream

func (s *Stream) GetStream() OptLabelSet

GetStream returns the value of Stream.

func (*Stream) GetValues

func (s *Stream) GetValues() []LogEntry

GetValues returns the value of Values.

func (*Stream) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Stream) SetFake

func (s *Stream) SetFake()

SetFake set fake values.

func (*Stream) SetStream

func (s *Stream) SetStream(val OptLabelSet)

SetStream sets the value of Stream.

func (*Stream) SetValues

func (s *Stream) SetValues(val []LogEntry)

SetValues sets the value of Values.

func (*Stream) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Stream) Validate

func (s *Stream) Validate() error

type Streams

type Streams []Stream

func (*Streams) Decode

func (s *Streams) Decode(d *jx.Decoder) error

Decode decodes Streams from json.

func (Streams) Encode

func (s Streams) Encode(e *jx.Encoder)

Encode encodes Streams as json.

func (Streams) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Streams) SetFake

func (s *Streams) SetFake()

SetFake set fake values.

func (*Streams) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (Streams) Validate

func (s Streams) Validate() error

type StreamsResult

type StreamsResult struct {
	Result Streams `json:"result"`
	Stats  *Stats  `json:"stats"`
}

Ref: #/components/schemas/StreamsResult

func (*StreamsResult) Decode

func (s *StreamsResult) Decode(d *jx.Decoder) error

Decode decodes StreamsResult from json.

func (*StreamsResult) Encode

func (s *StreamsResult) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*StreamsResult) GetResult

func (s *StreamsResult) GetResult() Streams

GetResult returns the value of Result.

func (*StreamsResult) GetStats

func (s *StreamsResult) GetStats() *Stats

GetStats returns the value of Stats.

func (*StreamsResult) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*StreamsResult) SetFake

func (s *StreamsResult) SetFake()

SetFake set fake values.

func (*StreamsResult) SetResult

func (s *StreamsResult) SetResult(val Streams)

SetResult sets the value of Result.

func (*StreamsResult) SetStats

func (s *StreamsResult) SetStats(val *Stats)

SetStats sets the value of Stats.

func (*StreamsResult) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*StreamsResult) Validate

func (s *StreamsResult) Validate() error

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) LabelValues

func (UnimplementedHandler) LabelValues(ctx context.Context, params LabelValuesParams) (r *Values, _ error)

LabelValues implements labelValues operation.

Get values of label.

GET /loki/api/v1/label/{name}/values

func (UnimplementedHandler) Labels

func (UnimplementedHandler) Labels(ctx context.Context, params LabelsParams) (r *Labels, _ error)

Labels implements labels operation.

Get labels. Used by Grafana to test connection to Loki.

GET /loki/api/v1/labels

func (UnimplementedHandler) NewError

func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)

NewError creates *ErrorStatusCode from error returned by handler.

Used for common default response.

func (UnimplementedHandler) Push

Push implements push operation.

Push data.

POST /loki/api/v1/push

func (UnimplementedHandler) Query

Query implements query operation.

Query.

GET /loki/api/v1/query

func (UnimplementedHandler) QueryRange

func (UnimplementedHandler) QueryRange(ctx context.Context, params QueryRangeParams) (r *QueryResponse, _ error)

QueryRange implements queryRange operation.

Query range.

GET /loki/api/v1/query_range

func (UnimplementedHandler) Series

func (UnimplementedHandler) Series(ctx context.Context, params SeriesParams) (r *Maps, _ error)

Series implements series operation.

Get series.

GET /loki/api/v1/series

type Values

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

Array of strings. Ref: #/components/schemas/Values

func (*Values) Decode

func (s *Values) Decode(d *jx.Decoder) error

Decode decodes Values from json.

func (*Values) Encode

func (s *Values) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Values) GetData

func (s *Values) GetData() []string

GetData returns the value of Data.

func (*Values) GetStatus

func (s *Values) GetStatus() string

GetStatus returns the value of Status.

func (*Values) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Values) SetData

func (s *Values) SetData(val []string)

SetData sets the value of Data.

func (*Values) SetFake

func (s *Values) SetFake()

SetFake set fake values.

func (*Values) SetStatus

func (s *Values) SetStatus(val string)

SetStatus sets the value of Status.

func (*Values) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Values) Validate

func (s *Values) Validate() error

type Vector

type Vector struct {
	Metric OptLabelSet          `json:"metric"`
	Value  PrometheusSamplePair `json:"value"`
}

Ref: #/components/schemas/Vector

func (*Vector) Decode

func (s *Vector) Decode(d *jx.Decoder) error

Decode decodes Vector from json.

func (*Vector) Encode

func (s *Vector) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Vector) GetMetric

func (s *Vector) GetMetric() OptLabelSet

GetMetric returns the value of Metric.

func (*Vector) GetValue

func (s *Vector) GetValue() PrometheusSamplePair

GetValue returns the value of Value.

func (*Vector) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Vector) SetFake

func (s *Vector) SetFake()

SetFake set fake values.

func (*Vector) SetMetric

func (s *Vector) SetMetric(val OptLabelSet)

SetMetric sets the value of Metric.

func (*Vector) SetValue

func (s *Vector) SetValue(val PrometheusSamplePair)

SetValue sets the value of Value.

func (*Vector) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Vector) Validate

func (s *Vector) Validate() error

type VectorResult

type VectorResult struct {
	Result []Vector `json:"result"`
	Stats  *Stats   `json:"stats"`
}

Ref: #/components/schemas/VectorResult

func (*VectorResult) Decode

func (s *VectorResult) Decode(d *jx.Decoder) error

Decode decodes VectorResult from json.

func (*VectorResult) Encode

func (s *VectorResult) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*VectorResult) GetResult

func (s *VectorResult) GetResult() []Vector

GetResult returns the value of Result.

func (*VectorResult) GetStats

func (s *VectorResult) GetStats() *Stats

GetStats returns the value of Stats.

func (*VectorResult) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*VectorResult) SetFake

func (s *VectorResult) SetFake()

SetFake set fake values.

func (*VectorResult) SetResult

func (s *VectorResult) SetResult(val []Vector)

SetResult sets the value of Result.

func (*VectorResult) SetStats

func (s *VectorResult) SetStats(val *Stats)

SetStats sets the value of Stats.

func (*VectorResult) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*VectorResult) Validate

func (s *VectorResult) Validate() error

Jump to

Keyboard shortcuts

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