Documentation ¶
Index ¶
- func DefaultLimitsConfig() validation.Limits
- func InitWorkerService(logger log.Logger, cfg WorkerServiceConfig, reg prometheus.Registerer, ...) (serve services.Service, err error)
- func NewQuerierHTTPHandler(h *Handler) http.Handler
- func WrapQuerySpanAndTimeout(call string, limits Limits) middleware.Interface
- type Config
- type Engine
- type Handler
- type IngesterQuerier
- func (q *IngesterQuerier) GetChunkIDs(ctx context.Context, from, through model.Time, matchers ...*labels.Matcher) ([]string, error)
- func (q *IngesterQuerier) Label(ctx context.Context, req *logproto.LabelRequest) ([][]string, error)
- func (q *IngesterQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) ([]iter.EntryIterator, error)
- func (q *IngesterQuerier) SelectSample(ctx context.Context, params logql.SelectSampleParams) ([]iter.SampleIterator, error)
- func (q *IngesterQuerier) Series(ctx context.Context, req *logproto.SeriesRequest) ([][]logproto.SeriesIdentifier, error)
- func (q *IngesterQuerier) Stats(ctx context.Context, _ string, from, through model.Time, ...) (*index_stats.Stats, error)
- func (q *IngesterQuerier) Tail(ctx context.Context, req *logproto.TailRequest) (map[string]logproto.Querier_TailClient, error)
- func (q *IngesterQuerier) TailDisconnectedIngesters(ctx context.Context, req *logproto.TailRequest, ...) (map[string]logproto.Querier_TailClient, error)
- func (q *IngesterQuerier) TailersCount(ctx context.Context) ([]uint32, error)
- func (q *IngesterQuerier) Volume(ctx context.Context, _ string, from, through model.Time, limit int32, ...) (*logproto.VolumeResponse, error)
- type Limits
- type Metrics
- type MultiTenantQuerier
- func (q *MultiTenantQuerier) DetectedLabels(ctx context.Context, req *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error)
- func (q *MultiTenantQuerier) IndexShards(ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64) (*logproto.ShardsResponse, error)
- func (q *MultiTenantQuerier) IndexStats(ctx context.Context, req *loghttp.RangeQuery) (*stats.Stats, error)
- func (q *MultiTenantQuerier) Label(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error)
- func (q *MultiTenantQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) (iter.EntryIterator, error)
- func (q *MultiTenantQuerier) SelectSamples(ctx context.Context, params logql.SelectSampleParams) (iter.SampleIterator, error)
- func (q *MultiTenantQuerier) Series(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, error)
- func (q *MultiTenantQuerier) Volume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
- type Querier
- type QuerierAPI
- func (q *QuerierAPI) DetectedFieldsHandler(ctx context.Context, req *logproto.DetectedFieldsRequest) (*logproto.DetectedFieldsResponse, error)
- func (q *QuerierAPI) DetectedLabelsHandler(ctx context.Context, req *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error)
- func (q *QuerierAPI) IndexShardsHandler(ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64) (*logproto.ShardsResponse, error)
- func (q *QuerierAPI) IndexStatsHandler(ctx context.Context, req *loghttp.RangeQuery) (*logproto.IndexStatsResponse, error)
- func (q *QuerierAPI) InstantQueryHandler(ctx context.Context, req *queryrange.LokiInstantRequest) (logqlmodel.Result, error)
- func (q *QuerierAPI) LabelHandler(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error)
- func (q *QuerierAPI) RangeQueryHandler(ctx context.Context, req *queryrange.LokiRequest) (logqlmodel.Result, error)
- func (q *QuerierAPI) SeriesHandler(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, stats.Result, error)
- func (q *QuerierAPI) TailHandler(w http.ResponseWriter, r *http.Request)
- func (q *QuerierAPI) VolumeHandler(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
- type QueryResponse
- type SingleTenantQuerier
- func (*SingleTenantQuerier) Check(_ context.Context, _ *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
- func (q *SingleTenantQuerier) DetectedFields(_ context.Context, _ *logproto.DetectedFieldsRequest) (*logproto.DetectedFieldsResponse, error)
- func (q *SingleTenantQuerier) DetectedLabels(_ context.Context, _ *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error)
- func (q *SingleTenantQuerier) IndexShards(ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64) (*logproto.ShardsResponse, error)
- func (q *SingleTenantQuerier) IndexStats(ctx context.Context, req *loghttp.RangeQuery) (*stats.Stats, error)
- func (q *SingleTenantQuerier) Label(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error)
- func (q *SingleTenantQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) (iter.EntryIterator, error)
- func (q *SingleTenantQuerier) SelectSamples(ctx context.Context, params logql.SelectSampleParams) (iter.SampleIterator, error)
- func (q *SingleTenantQuerier) Series(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, error)
- func (q *SingleTenantQuerier) Tail(ctx context.Context, req *logproto.TailRequest, categorizedLabels bool) (*Tailer, error)
- func (q *SingleTenantQuerier) Volume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
- type Store
- type Tailer
- type TenantEntryIterator
- type TenantSampleIterator
- type TimeRangeLimits
- type WorkerServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLimitsConfig ¶
func DefaultLimitsConfig() validation.Limits
func InitWorkerService ¶
func InitWorkerService( logger log.Logger, cfg WorkerServiceConfig, reg prometheus.Registerer, handler queryrangebase.Handler, codec querier_worker.RequestCodec, ) (serve services.Service, err error)
InitWorkerService takes a config object, a map of routes to handlers, an external http router and external http handler, and an auth middleware wrapper. This function creates an internal HTTP router that responds to all the provided query routes/handlers. This router can either be registered with the external Loki HTTP server, or be used internally by a querier worker so that it does not conflict with the routes registered by the Query Frontend module.
Query-Frontend Enabled: If Loki has an All or QueryFrontend target, the internal HTTP router is wrapped with Tenant ID parsing middleware and passed to the frontend worker.
Querier Standalone: The querier will register the internal HTTP router with the external HTTP router for the Prometheus API routes. Then the external HTTP server will be passed as a http.Handler to the frontend worker.
func NewQuerierHTTPHandler ¶
func WrapQuerySpanAndTimeout ¶
func WrapQuerySpanAndTimeout(call string, limits Limits) middleware.Interface
WrapQuerySpanAndTimeout applies a context deadline and a span logger to a query call.
The timeout is based on the per-tenant query timeout configuration.
Types ¶
type Config ¶
type Config struct { TailMaxDuration time.Duration `yaml:"tail_max_duration"` ExtraQueryDelay time.Duration `yaml:"extra_query_delay,omitempty"` QueryIngestersWithin time.Duration `yaml:"query_ingesters_within,omitempty"` IngesterQueryStoreMaxLookback time.Duration `yaml:"-"` Engine logql.EngineOpts `yaml:"engine,omitempty"` MaxConcurrent int `yaml:"max_concurrent"` QueryStoreOnly bool `yaml:"query_store_only"` QueryIngesterOnly bool `yaml:"query_ingester_only"` MultiTenantQueriesEnabled bool `yaml:"multi_tenant_queries_enabled"` PerRequestLimitsEnabled bool `yaml:"per_request_limits_enabled"` }
Config for a querier.
func (*Config) RegisterFlags ¶
RegisterFlags register flags.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewQuerierHandler ¶
func NewQuerierHandler(api *QuerierAPI) *Handler
func (*Handler) Do ¶
func (h *Handler) Do(ctx context.Context, req queryrangebase.Request) (queryrangebase.Response, error)
type IngesterQuerier ¶
type IngesterQuerier struct {
// contains filtered or unexported fields
}
IngesterQuerier helps with querying the ingesters.
func NewIngesterQuerier ¶
func (*IngesterQuerier) GetChunkIDs ¶
func (*IngesterQuerier) Label ¶
func (q *IngesterQuerier) Label(ctx context.Context, req *logproto.LabelRequest) ([][]string, error)
func (*IngesterQuerier) SelectLogs ¶
func (q *IngesterQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) ([]iter.EntryIterator, error)
func (*IngesterQuerier) SelectSample ¶
func (q *IngesterQuerier) SelectSample(ctx context.Context, params logql.SelectSampleParams) ([]iter.SampleIterator, error)
func (*IngesterQuerier) Series ¶
func (q *IngesterQuerier) Series(ctx context.Context, req *logproto.SeriesRequest) ([][]logproto.SeriesIdentifier, error)
func (*IngesterQuerier) Tail ¶
func (q *IngesterQuerier) Tail(ctx context.Context, req *logproto.TailRequest) (map[string]logproto.Querier_TailClient, error)
func (*IngesterQuerier) TailDisconnectedIngesters ¶
func (q *IngesterQuerier) TailDisconnectedIngesters(ctx context.Context, req *logproto.TailRequest, connectedIngestersAddr []string) (map[string]logproto.Querier_TailClient, error)
func (*IngesterQuerier) TailersCount ¶
func (q *IngesterQuerier) TailersCount(ctx context.Context) ([]uint32, error)
type Limits ¶
type Limits querier_limits.Limits
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(r prometheus.Registerer) *Metrics
type MultiTenantQuerier ¶
type MultiTenantQuerier struct {
Querier
}
MultiTenantQuerier is able to query across different tenants.
func NewMultiTenantQuerier ¶
func NewMultiTenantQuerier(querier Querier, _ log.Logger) *MultiTenantQuerier
NewMultiTenantQuerier returns a new querier able to query across different tenants.
func (*MultiTenantQuerier) DetectedLabels ¶
func (q *MultiTenantQuerier) DetectedLabels(ctx context.Context, req *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error)
func (*MultiTenantQuerier) IndexShards ¶
func (q *MultiTenantQuerier) IndexShards( ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64, ) (*logproto.ShardsResponse, error)
func (*MultiTenantQuerier) IndexStats ¶
func (q *MultiTenantQuerier) IndexStats(ctx context.Context, req *loghttp.RangeQuery) (*stats.Stats, error)
func (*MultiTenantQuerier) Label ¶
func (q *MultiTenantQuerier) Label(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error)
func (*MultiTenantQuerier) SelectLogs ¶
func (q *MultiTenantQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) (iter.EntryIterator, error)
func (*MultiTenantQuerier) SelectSamples ¶
func (q *MultiTenantQuerier) SelectSamples(ctx context.Context, params logql.SelectSampleParams) (iter.SampleIterator, error)
func (*MultiTenantQuerier) Series ¶
func (q *MultiTenantQuerier) Series(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, error)
func (*MultiTenantQuerier) Volume ¶
func (q *MultiTenantQuerier) Volume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
type Querier ¶
type Querier interface { logql.Querier Label(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error) Series(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, error) Tail(ctx context.Context, req *logproto.TailRequest, categorizedLabels bool) (*Tailer, error) IndexStats(ctx context.Context, req *loghttp.RangeQuery) (*stats.Stats, error) IndexShards(ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64) (*logproto.ShardsResponse, error) Volume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error) DetectedFields(ctx context.Context, req *logproto.DetectedFieldsRequest) (*logproto.DetectedFieldsResponse, error) DetectedLabels(ctx context.Context, req *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error) }
Querier can select logs and samples and handle query requests.
type QuerierAPI ¶
type QuerierAPI struct {
// contains filtered or unexported fields
}
nolint // QuerierAPI defines HTTP handler functions for the querier.
func NewQuerierAPI ¶
NewQuerierAPI returns an instance of the QuerierAPI.
func (*QuerierAPI) DetectedFieldsHandler ¶
func (q *QuerierAPI) DetectedFieldsHandler(ctx context.Context, req *logproto.DetectedFieldsRequest) (*logproto.DetectedFieldsResponse, error)
func (*QuerierAPI) DetectedLabelsHandler ¶
func (q *QuerierAPI) DetectedLabelsHandler(ctx context.Context, req *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error)
DetectedLabelsHandler returns a response for detected labels
func (*QuerierAPI) IndexShardsHandler ¶
func (q *QuerierAPI) IndexShardsHandler(ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64) (*logproto.ShardsResponse, error)
func (*QuerierAPI) IndexStatsHandler ¶
func (q *QuerierAPI) IndexStatsHandler(ctx context.Context, req *loghttp.RangeQuery) (*logproto.IndexStatsResponse, error)
IndexStatsHandler queries the index for the data statistics related to a query
func (*QuerierAPI) InstantQueryHandler ¶
func (q *QuerierAPI) InstantQueryHandler(ctx context.Context, req *queryrange.LokiInstantRequest) (logqlmodel.Result, error)
InstantQueryHandler is a http.HandlerFunc for instant queries.
func (*QuerierAPI) LabelHandler ¶
func (q *QuerierAPI) LabelHandler(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error)
LabelHandler is a http.HandlerFunc for handling label queries.
func (*QuerierAPI) RangeQueryHandler ¶
func (q *QuerierAPI) RangeQueryHandler(ctx context.Context, req *queryrange.LokiRequest) (logqlmodel.Result, error)
RangeQueryHandler is a http.HandlerFunc for range queries and legacy log queries
func (*QuerierAPI) SeriesHandler ¶
func (q *QuerierAPI) SeriesHandler(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, stats.Result, error)
SeriesHandler returns the list of time series that match a certain label set. See https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers
func (*QuerierAPI) TailHandler ¶
func (q *QuerierAPI) TailHandler(w http.ResponseWriter, r *http.Request)
TailHandler is a http.HandlerFunc for handling tail queries.
func (*QuerierAPI) VolumeHandler ¶
func (q *QuerierAPI) VolumeHandler(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
VolumeHandler queries the index label volumes related to the passed matchers and given time range. Returns either N values where N is the time range / step and a single value for a time range depending on the request.
type QueryResponse ¶ added in v0.4.0
type SingleTenantQuerier ¶
type SingleTenantQuerier struct {
// contains filtered or unexported fields
}
SingleTenantQuerier handles single tenant queries.
func New ¶
func New(cfg Config, store Store, ingesterQuerier *IngesterQuerier, limits Limits, d deleteGetter, r prometheus.Registerer, logger log.Logger) (*SingleTenantQuerier, error)
New makes a new Querier.
func (*SingleTenantQuerier) Check ¶
func (*SingleTenantQuerier) Check(_ context.Context, _ *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
Check implements the grpc healthcheck
func (*SingleTenantQuerier) DetectedFields ¶
func (q *SingleTenantQuerier) DetectedFields(_ context.Context, _ *logproto.DetectedFieldsRequest) (*logproto.DetectedFieldsResponse, error)
func (*SingleTenantQuerier) DetectedLabels ¶
func (q *SingleTenantQuerier) DetectedLabels(_ context.Context, _ *logproto.DetectedLabelsRequest) (*logproto.DetectedLabelsResponse, error)
func (*SingleTenantQuerier) IndexShards ¶
func (q *SingleTenantQuerier) IndexShards( ctx context.Context, req *loghttp.RangeQuery, targetBytesPerShard uint64, ) (*logproto.ShardsResponse, error)
func (*SingleTenantQuerier) IndexStats ¶
func (q *SingleTenantQuerier) IndexStats(ctx context.Context, req *loghttp.RangeQuery) (*stats.Stats, error)
func (*SingleTenantQuerier) Label ¶
func (q *SingleTenantQuerier) Label(ctx context.Context, req *logproto.LabelRequest) (*logproto.LabelResponse, error)
Label does the heavy lifting for a Label query.
func (*SingleTenantQuerier) SelectLogs ¶
func (q *SingleTenantQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) (iter.EntryIterator, error)
Select Implements logql.Querier which select logs via matchers and regex filters.
func (*SingleTenantQuerier) SelectSamples ¶
func (q *SingleTenantQuerier) SelectSamples(ctx context.Context, params logql.SelectSampleParams) (iter.SampleIterator, error)
func (*SingleTenantQuerier) Series ¶
func (q *SingleTenantQuerier) Series(ctx context.Context, req *logproto.SeriesRequest) (*logproto.SeriesResponse, error)
Series fetches any matching series for a list of matcher sets
func (*SingleTenantQuerier) Tail ¶
func (q *SingleTenantQuerier) Tail(ctx context.Context, req *logproto.TailRequest, categorizedLabels bool) (*Tailer, error)
Tail keeps getting matching logs from all ingesters for given query
func (*SingleTenantQuerier) Volume ¶
func (q *SingleTenantQuerier) Volume(ctx context.Context, req *logproto.VolumeRequest) (*logproto.VolumeResponse, error)
type Store ¶
type Store interface { storage.SelectStore index.BaseReader index.StatsReader }
Store is the store interface we need on the querier.
type Tailer ¶ added in v0.2.0
type Tailer struct {
// contains filtered or unexported fields
}
Tailer manages complete lifecycle of a tail request
type TenantEntryIterator ¶
type TenantEntryIterator struct { iter.EntryIterator // contains filtered or unexported fields }
TenantEntry Iterator wraps an entry iterator and adds the tenant label.
func NewTenantEntryIterator ¶
func NewTenantEntryIterator(iter iter.EntryIterator, id string) *TenantEntryIterator
func (*TenantEntryIterator) Labels ¶
func (i *TenantEntryIterator) Labels() string
type TenantSampleIterator ¶
type TenantSampleIterator struct { iter.SampleIterator // contains filtered or unexported fields }
TenantEntry Iterator wraps a sample iterator and adds the tenant label.
func NewTenantSampleIterator ¶
func NewTenantSampleIterator(iter iter.SampleIterator, id string) *TenantSampleIterator
func (*TenantSampleIterator) Labels ¶
func (i *TenantSampleIterator) Labels() string
type TimeRangeLimits ¶
type TimeRangeLimits querier_limits.TimeRangeLimits
type WorkerServiceConfig ¶
type WorkerServiceConfig struct { AllEnabled bool ReadEnabled bool GrpcListenAddress string GrpcListenPort int QuerierMaxConcurrent int QuerierWorkerConfig *querier_worker.Config QueryFrontendEnabled bool QuerySchedulerEnabled bool SchedulerRing ring.ReadRing }
func (WorkerServiceConfig) QuerierRunningStandalone ¶
func (cfg WorkerServiceConfig) QuerierRunningStandalone() bool
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package contains methods to marshal logqmodel types to queryrange Protobuf types.
|
Package contains methods to marshal logqmodel types to queryrange Protobuf types. |