frontend

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusClientClosedRequest is the status code for when a client request cancellation of an http request
	StatusClientClosedRequest = 499
)

Variables

View Source
var (
	ErrInvalidLengthFrontend = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowFrontend   = fmt.Errorf("proto: integer overflow")
)

Functions

func NewWorker

func NewWorker(cfg WorkerConfig, querierCfg querier.Config, server *server.Server, log log.Logger) (services.Service, error)

NewWorker creates a new worker and returns a service that is wrapping it. If no address is specified, it returns nil service (and no error).

func RegisterFrontendServer

func RegisterFrontendServer(s *grpc.Server, srv FrontendServer)

Types

type Config

type Config struct {
	MaxOutstandingPerTenant int           `yaml:"max_outstanding_per_tenant"`
	CompressResponses       bool          `yaml:"compress_responses"`
	DownstreamURL           string        `yaml:"downstream_url"`
	LogQueriesLongerThan    time.Duration `yaml:"log_queries_longer_than"`
}

Config for a Frontend.

func (*Config) RegisterFlags

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

RegisterFlags adds the flags required to config this to the given FlagSet.

type Frontend

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

Frontend queues HTTP requests, dispatches them to backends, and handles retries for requests which failed.

func New

func New(cfg Config, log log.Logger, registerer prometheus.Registerer) (*Frontend, error)

New creates a new frontend.

func (*Frontend) CheckReady added in v1.3.0

func (f *Frontend) CheckReady(_ context.Context) error

CheckReady determines if the query frontend is ready. Function parameters/return chosen to match the same method in the ingester

func (*Frontend) Close

func (f *Frontend) Close()

Close stops new requests and errors out any pending requests.

func (*Frontend) Handler

func (f *Frontend) Handler() http.Handler

Handler for HTTP requests.

func (*Frontend) Process

func (f *Frontend) Process(server Frontend_ProcessServer) error

Process allows backends to pull requests from the frontend.

func (*Frontend) RoundTrip

func (f *Frontend) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implement http.Transport.

func (*Frontend) RoundTripGRPC

func (f *Frontend) RoundTripGRPC(ctx context.Context, req *ProcessRequest) (*ProcessResponse, error)

RoundTripGRPC round trips a proto (instead of a HTTP request).

func (*Frontend) Wrap added in v0.4.0

func (f *Frontend) Wrap(trw Tripperware)

Wrap uses a Tripperware to chain a new RoundTripper to the frontend.

type FrontendClient

type FrontendClient interface {
	Process(ctx context.Context, opts ...grpc.CallOption) (Frontend_ProcessClient, error)
}

FrontendClient is the client API for Frontend service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewFrontendClient

func NewFrontendClient(cc *grpc.ClientConn) FrontendClient

type FrontendServer

type FrontendServer interface {
	Process(Frontend_ProcessServer) error
}

FrontendServer is the server API for Frontend service.

type Frontend_ProcessClient

type Frontend_ProcessClient interface {
	Send(*ProcessResponse) error
	Recv() (*ProcessRequest, error)
	grpc.ClientStream
}

type Frontend_ProcessServer

type Frontend_ProcessServer interface {
	Send(*ProcessRequest) error
	Recv() (*ProcessResponse, error)
	grpc.ServerStream
}

type ProcessRequest

type ProcessRequest struct {
	HttpRequest *httpgrpc.HTTPRequest `protobuf:"bytes,1,opt,name=httpRequest,proto3" json:"httpRequest,omitempty"`
}

func (*ProcessRequest) Descriptor

func (*ProcessRequest) Descriptor() ([]byte, []int)

func (*ProcessRequest) Equal

func (this *ProcessRequest) Equal(that interface{}) bool

func (*ProcessRequest) GetHttpRequest

func (m *ProcessRequest) GetHttpRequest() *httpgrpc.HTTPRequest

func (*ProcessRequest) GoString

func (this *ProcessRequest) GoString() string

func (*ProcessRequest) Marshal

func (m *ProcessRequest) Marshal() (dAtA []byte, err error)

func (*ProcessRequest) MarshalTo

func (m *ProcessRequest) MarshalTo(dAtA []byte) (int, error)

func (*ProcessRequest) MarshalToSizedBuffer added in v0.7.0

func (m *ProcessRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ProcessRequest) ProtoMessage

func (*ProcessRequest) ProtoMessage()

func (*ProcessRequest) Reset

func (m *ProcessRequest) Reset()

func (*ProcessRequest) Size

func (m *ProcessRequest) Size() (n int)

func (*ProcessRequest) String

func (this *ProcessRequest) String() string

func (*ProcessRequest) Unmarshal

func (m *ProcessRequest) Unmarshal(dAtA []byte) error

func (*ProcessRequest) XXX_DiscardUnknown

func (m *ProcessRequest) XXX_DiscardUnknown()

func (*ProcessRequest) XXX_Marshal

func (m *ProcessRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProcessRequest) XXX_Merge

func (m *ProcessRequest) XXX_Merge(src proto.Message)

func (*ProcessRequest) XXX_Size

func (m *ProcessRequest) XXX_Size() int

func (*ProcessRequest) XXX_Unmarshal

func (m *ProcessRequest) XXX_Unmarshal(b []byte) error

type ProcessResponse

type ProcessResponse struct {
	HttpResponse *httpgrpc.HTTPResponse `protobuf:"bytes,1,opt,name=httpResponse,proto3" json:"httpResponse,omitempty"`
}

func (*ProcessResponse) Descriptor

func (*ProcessResponse) Descriptor() ([]byte, []int)

func (*ProcessResponse) Equal

func (this *ProcessResponse) Equal(that interface{}) bool

func (*ProcessResponse) GetHttpResponse

func (m *ProcessResponse) GetHttpResponse() *httpgrpc.HTTPResponse

func (*ProcessResponse) GoString

func (this *ProcessResponse) GoString() string

func (*ProcessResponse) Marshal

func (m *ProcessResponse) Marshal() (dAtA []byte, err error)

func (*ProcessResponse) MarshalTo

func (m *ProcessResponse) MarshalTo(dAtA []byte) (int, error)

func (*ProcessResponse) MarshalToSizedBuffer added in v0.7.0

func (m *ProcessResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ProcessResponse) ProtoMessage

func (*ProcessResponse) ProtoMessage()

func (*ProcessResponse) Reset

func (m *ProcessResponse) Reset()

func (*ProcessResponse) Size

func (m *ProcessResponse) Size() (n int)

func (*ProcessResponse) String

func (this *ProcessResponse) String() string

func (*ProcessResponse) Unmarshal

func (m *ProcessResponse) Unmarshal(dAtA []byte) error

func (*ProcessResponse) XXX_DiscardUnknown

func (m *ProcessResponse) XXX_DiscardUnknown()

func (*ProcessResponse) XXX_Marshal

func (m *ProcessResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProcessResponse) XXX_Merge

func (m *ProcessResponse) XXX_Merge(src proto.Message)

func (*ProcessResponse) XXX_Size

func (m *ProcessResponse) XXX_Size() int

func (*ProcessResponse) XXX_Unmarshal

func (m *ProcessResponse) XXX_Unmarshal(b []byte) error

type RoundTripFunc added in v0.2.0

type RoundTripFunc func(*http.Request) (*http.Response, error)

RoundTripFunc is to http.RoundTripper what http.HandlerFunc is to http.Handler.

func (RoundTripFunc) RoundTrip added in v0.2.0

func (f RoundTripFunc) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type Tripperware added in v0.4.0

type Tripperware func(http.RoundTripper) http.RoundTripper

Tripperware is a signature for all http client-side middleware.

type UnimplementedFrontendServer added in v0.7.0

type UnimplementedFrontendServer struct {
}

UnimplementedFrontendServer can be embedded to have forward compatible implementations.

func (*UnimplementedFrontendServer) Process added in v0.7.0

type WorkerConfig

type WorkerConfig struct {
	Address             string        `yaml:"frontend_address"`
	Parallelism         int           `yaml:"parallelism"`
	MatchMaxConcurrency bool          `yaml:"match_max_concurrent"`
	DNSLookupDuration   time.Duration `yaml:"dns_lookup_duration"`

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

WorkerConfig is config for a worker.

func (*WorkerConfig) RegisterFlags

func (cfg *WorkerConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

func (*WorkerConfig) Validate added in v1.3.0

func (cfg *WorkerConfig) Validate(log log.Logger) error

Jump to

Keyboard shortcuts

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