querier

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: AGPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetShuffleShardingSubring

func GetShuffleShardingSubring(ring ring.ReadRing, userID string, limits StoreGatewayLimits) ring.ReadRing

GetShuffleShardingSubring returns the subring to be used for a given user. This function should be used both by store-gateway and querier in order to guarantee the same logic is used.

func NewMergeIterator

func NewMergeIterator[
	R any,
	Req Request,
	Res Response,
](ctx context.Context, r ResponseFromReplica[BidiClientMerge[Req, Res]],
) *mergeIterator[R, Req, Res]

NewMergeIterator return a new iterator that stream profiles and allows to filter them using `Keep` to keep only a subset of the profiles for an aggregation result. Merging or querying profiles sample values is expensive, we only merge the sample of the profiles that are kept. On creating the iterator, we send a request to ingesters to fetch the first batch.

Types

type BidiClientMerge

type BidiClientMerge[Req any, Res any] interface {
	Send(Req) error
	Receive() (Res, error)
	CloseRequest() error
	CloseResponse() error
}

type ClientFactory

type ClientFactory[T any] func(addr string) (T, error)

type Closer

type Closer interface {
	CloseRequest() error
	CloseResponse() error
}

type Config

type Config struct {
	PoolConfig      clientpool.PoolConfig `yaml:"pool_config,omitempty"`
	QueryStoreAfter time.Duration         `yaml:"query_store_after" category:"advanced"`
}

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(fs *flag.FlagSet)

RegisterFlags registers distributor-related flags.

type IngesterQuerier

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

IngesterQuerier helps with querying the ingesters.

func NewIngesterQuerier

func NewIngesterQuerier(pool *ring_client.Pool, ring ring.ReadRing) *IngesterQuerier

type IngesterQueryClient

type IngesterQueryClient interface {
	LabelValues(context.Context, *connect.Request[typesv1.LabelValuesRequest]) (*connect.Response[typesv1.LabelValuesResponse], error)
	LabelNames(context.Context, *connect.Request[typesv1.LabelNamesRequest]) (*connect.Response[typesv1.LabelNamesResponse], error)
	ProfileTypes(context.Context, *connect.Request[ingestv1.ProfileTypesRequest]) (*connect.Response[ingestv1.ProfileTypesResponse], error)
	Series(ctx context.Context, req *connect.Request[ingestv1.SeriesRequest]) (*connect.Response[ingestv1.SeriesResponse], error)
	MergeProfilesStacktraces(context.Context) clientpool.BidiClientMergeProfilesStacktraces
	MergeProfilesLabels(ctx context.Context) clientpool.BidiClientMergeProfilesLabels
	MergeProfilesPprof(ctx context.Context) clientpool.BidiClientMergeProfilesPprof
}

type MergeIterator

type MergeIterator interface {
	iter.Iterator[*ProfileWithLabels]
	Keep()
}

type MergeResult

type MergeResult[R any] interface {
	Result() (R, error)
}

type ProfileValue

type ProfileValue struct {
	Ts         int64
	Lbs        []*typesv1.LabelPair
	LabelsHash uint64
	Value      float64
}

func (ProfileValue) Labels

func (p ProfileValue) Labels() phlaremodel.Labels

func (ProfileValue) Timestamp

func (p ProfileValue) Timestamp() model.Time

type ProfileWithLabels

type ProfileWithLabels struct {
	Timestamp int64
	phlaremodel.Labels
	IngesterAddr string
}

type Querier

type Querier struct {
	services.Service
	// contains filtered or unexported fields
}

func New

func New(cfg Config, ingestersRing ring.ReadRing, factory ring_client.PoolFactory, storeGatewayQuerier *StoreGatewayQuerier, reg prometheus.Registerer, logger log.Logger, clientsOptions ...connect.ClientOption) (*Querier, error)

func (*Querier) Diff

func (q *Querier) Diff(ctx context.Context, req *connect.Request[querierv1.DiffRequest]) (*connect.Response[querierv1.DiffResponse], error)

func (*Querier) LabelNames

func (q *Querier) LabelNames(ctx context.Context, req *connect.Request[typesv1.LabelNamesRequest]) (*connect.Response[typesv1.LabelNamesResponse], error)

func (*Querier) LabelValues

func (q *Querier) LabelValues(ctx context.Context, req *connect.Request[typesv1.LabelValuesRequest]) (*connect.Response[typesv1.LabelValuesResponse], error)

func (*Querier) ProfileTypes

func (q *Querier) ProfileTypes(ctx context.Context, req *connect.Request[querierv1.ProfileTypesRequest]) (*connect.Response[querierv1.ProfileTypesResponse], error)

func (*Querier) SelectMergeProfile

func (q *Querier) SelectMergeProfile(ctx context.Context, req *connect.Request[querierv1.SelectMergeProfileRequest]) (*connect.Response[googlev1.Profile], error)

func (*Querier) SelectMergeStacktraces

func (q *Querier) SelectMergeStacktraces(ctx context.Context, req *connect.Request[querierv1.SelectMergeStacktracesRequest]) (*connect.Response[querierv1.SelectMergeStacktracesResponse], error)

func (*Querier) SelectSeries

func (q *Querier) SelectSeries(ctx context.Context, req *connect.Request[querierv1.SelectSeriesRequest]) (*connect.Response[querierv1.SelectSeriesResponse], error)

func (*Querier) Series

func (q *Querier) Series(ctx context.Context, req *connect.Request[querierv1.SeriesRequest]) (*connect.Response[querierv1.SeriesResponse], error)

type QueryHandlers

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

func (*QueryHandlers) LabelValues

func (q *QueryHandlers) LabelValues(w http.ResponseWriter, req *http.Request)

LabelValues only returns the label values for the given label name. This is mostly for fulfilling the pyroscope API and won't be used in the future. For example, /label-values?label=__name__ will return all the profile types.

func (*QueryHandlers) Render

func (q *QueryHandlers) Render(w http.ResponseWriter, req *http.Request)

func (*QueryHandlers) RenderDiff

func (q *QueryHandlers) RenderDiff(w http.ResponseWriter, req *http.Request)

type QueryReplicaFn

type QueryReplicaFn[T any, Querier any] func(context.Context, Querier) (T, error)

type ResponseFromReplica

type ResponseFromReplica[T any] struct {
	// contains filtered or unexported fields
}

type StoreGatewayLimits

type StoreGatewayLimits interface {
	StoreGatewayTenantShardSize(userID string) int
}

type StoreGatewayQuerier

type StoreGatewayQuerier struct {
	services.Service
	// contains filtered or unexported fields
}

func NewStoreGatewayQuerier

func NewStoreGatewayQuerier(
	gatewayCfg storegateway.Config,
	factory ring_client.PoolFactory,
	limits StoreGatewayLimits,
	logger log.Logger,
	reg prometheus.Registerer,
	clientsOptions ...connect.ClientOption,
) (*StoreGatewayQuerier, error)

type StoreGatewayQueryClient

type StoreGatewayQueryClient interface {
	MergeProfilesStacktraces(context.Context) clientpool.BidiClientMergeProfilesStacktraces
	MergeProfilesLabels(ctx context.Context) clientpool.BidiClientMergeProfilesLabels
	MergeProfilesPprof(ctx context.Context) clientpool.BidiClientMergeProfilesPprof
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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