frontend

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 42 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")
)
View Source
var Type_name = map[int32]string{
	0: "HTTP_REQUEST",
	1: "GET_ID",
}
View Source
var Type_value = map[string]int32{
	"HTTP_REQUEST": 0,
	"GET_ID":       1,
}

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 ClientToFrontend added in v1.5.0

type ClientToFrontend struct {
	HttpResponse *httpgrpc.HTTPResponse `protobuf:"bytes,1,opt,name=httpResponse,proto3" json:"httpResponse,omitempty"`
	ClientID     string                 `protobuf:"bytes,2,opt,name=clientID,proto3" json:"clientID,omitempty"`
}

func (*ClientToFrontend) Descriptor added in v1.5.0

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

func (*ClientToFrontend) Equal added in v1.5.0

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

func (*ClientToFrontend) GetClientID added in v1.5.0

func (m *ClientToFrontend) GetClientID() string

func (*ClientToFrontend) GetHttpResponse added in v1.5.0

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

func (*ClientToFrontend) GoString added in v1.5.0

func (this *ClientToFrontend) GoString() string

func (*ClientToFrontend) Marshal added in v1.5.0

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

func (*ClientToFrontend) MarshalTo added in v1.5.0

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

func (*ClientToFrontend) MarshalToSizedBuffer added in v1.5.0

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

func (*ClientToFrontend) ProtoMessage added in v1.5.0

func (*ClientToFrontend) ProtoMessage()

func (*ClientToFrontend) Reset added in v1.5.0

func (m *ClientToFrontend) Reset()

func (*ClientToFrontend) Size added in v1.5.0

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

func (*ClientToFrontend) String added in v1.5.0

func (this *ClientToFrontend) String() string

func (*ClientToFrontend) Unmarshal added in v1.5.0

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

func (*ClientToFrontend) XXX_DiscardUnknown added in v1.5.0

func (m *ClientToFrontend) XXX_DiscardUnknown()

func (*ClientToFrontend) XXX_Marshal added in v1.5.0

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

func (*ClientToFrontend) XXX_Merge added in v1.5.0

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

func (*ClientToFrontend) XXX_Size added in v1.5.0

func (m *ClientToFrontend) XXX_Size() int

func (*ClientToFrontend) XXX_Unmarshal added in v1.5.0

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

type Config

type Config struct {
	MaxOutstandingPerTenant int           `yaml:"max_outstanding_per_tenant"`
	CompressResponses       bool          `yaml:"compress_responses"`
	DownstreamURL           string        `yaml:"downstream_url"`
	MaxBodySize             int64         `yaml:"max_body_size"`
	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, limits Limits, 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 *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, 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 {
	// After calling this method, client enters a loop, in which it waits for
	// a "FrontendToClient" message and replies with single "ClientToFrontend" message.
	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 {
	// After calling this method, client enters a loop, in which it waits for
	// a "FrontendToClient" message and replies with single "ClientToFrontend" message.
	Process(Frontend_ProcessServer) error
}

FrontendServer is the server API for Frontend service.

type FrontendToClient added in v1.5.0

type FrontendToClient struct {
	HttpRequest *httpgrpc.HTTPRequest `protobuf:"bytes,1,opt,name=httpRequest,proto3" json:"httpRequest,omitempty"`
	Type        Type                  `protobuf:"varint,2,opt,name=type,proto3,enum=frontend.Type" json:"type,omitempty"`
}

func (*FrontendToClient) Descriptor added in v1.5.0

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

func (*FrontendToClient) Equal added in v1.5.0

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

func (*FrontendToClient) GetHttpRequest added in v1.5.0

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

func (*FrontendToClient) GetType added in v1.5.0

func (m *FrontendToClient) GetType() Type

func (*FrontendToClient) GoString added in v1.5.0

func (this *FrontendToClient) GoString() string

func (*FrontendToClient) Marshal added in v1.5.0

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

func (*FrontendToClient) MarshalTo added in v1.5.0

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

func (*FrontendToClient) MarshalToSizedBuffer added in v1.5.0

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

func (*FrontendToClient) ProtoMessage added in v1.5.0

func (*FrontendToClient) ProtoMessage()

func (*FrontendToClient) Reset added in v1.5.0

func (m *FrontendToClient) Reset()

func (*FrontendToClient) Size added in v1.5.0

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

func (*FrontendToClient) String added in v1.5.0

func (this *FrontendToClient) String() string

func (*FrontendToClient) Unmarshal added in v1.5.0

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

func (*FrontendToClient) XXX_DiscardUnknown added in v1.5.0

func (m *FrontendToClient) XXX_DiscardUnknown()

func (*FrontendToClient) XXX_Marshal added in v1.5.0

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

func (*FrontendToClient) XXX_Merge added in v1.5.0

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

func (*FrontendToClient) XXX_Size added in v1.5.0

func (m *FrontendToClient) XXX_Size() int

func (*FrontendToClient) XXX_Unmarshal added in v1.5.0

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

type Frontend_ProcessClient

type Frontend_ProcessClient interface {
	Send(*ClientToFrontend) error
	Recv() (*FrontendToClient, error)
	grpc.ClientStream
}

type Frontend_ProcessServer

type Frontend_ProcessServer interface {
	Send(*FrontendToClient) error
	Recv() (*ClientToFrontend, error)
	grpc.ServerStream
}

type Limits added in v1.5.0

type Limits interface {
	// Returns max queriers to use per tenant, or 0 if shuffle sharding is disabled.
	MaxQueriersPerUser(user string) int
}

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 Type added in v1.5.0

type Type int32
const (
	HTTP_REQUEST Type = 0
	GET_ID       Type = 1
)

func (Type) EnumDescriptor added in v1.5.0

func (Type) EnumDescriptor() ([]byte, []int)

func (Type) String added in v1.5.0

func (x Type) String() string

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"`
	QuerierID           string        `yaml:"id"`

	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