worker

package
v0.0.0-...-bfa2730 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerierWorker

func NewQuerierWorker(cfg Config, handler RequestHandler, log log.Logger, reg prometheus.Registerer, processFunction ProcessorFunction) (services.Service, error)

Types

type Config

type Config struct {
	FrontendAddress string        `yaml:"frontend_address"`
	DNSLookupPeriod time.Duration `yaml:"dns_lookup_duration"`

	Parallelism           int  `yaml:"parallelism"`
	MatchMaxConcurrency   bool `yaml:"match_max_concurrent"`
	MaxConcurrentRequests int  `yaml:"-"`

	QuerierID string `yaml:"id"`

	GRPCClientConfig grpcclient.Config `yaml:"grpc_client_config"`
}

type Processor

type Processor interface {
	// Each invocation of processQueriesOnSingleStream starts new streaming operation to query-frontend
	// or query-scheduler to fetch queries and execute them.
	//
	// This method must react on context being finished, and stop when that happens.
	//
	// ProcessorManager (not Processor) is responsible for starting as many goroutines as needed for each connection.
	ProcessQueriesOnSingleStream(ctx context.Context, conn *grpc.ClientConn, address string)

	// notifyShutdown notifies the remote query-frontend or query-scheduler that the querier is
	// shutting down.
	NotifyShutdown(ctx context.Context, conn *grpc.ClientConn, address string)
}

Single processor handles all streaming operations to query-frontend or query-scheduler to fetch queries and process them.

func NewFrontendProcessor

func NewFrontendProcessor(cfg Config, handler RequestHandler, log log.Logger, prcFunc ProcessorFunction) Processor

type ProcessorManager

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

ProcessorManager Manages processor goroutines for single grpc connection.

func NewProcessorManager

func NewProcessorManager(ctx context.Context, p Processor, conn *grpc.ClientConn, address string) *ProcessorManager

func (*ProcessorManager) Concurrency

func (pm *ProcessorManager) Concurrency(n int)

func (*ProcessorManager) Stop

func (pm *ProcessorManager) Stop()

type RequestHandler

type RequestHandler interface {
	Handle(context.Context, *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error)
}

Handler for HTTP requests wrapped in protobuf messages.

Jump to

Keyboard shortcuts

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