Documentation
¶
Index ¶
- Constants
- Variables
- func NewWorker(cfg WorkerConfig, querierCfg querier.Config, server *server.Server, ...) (services.Service, error)
- func RegisterFrontendServer(s *grpc.Server, srv FrontendServer)
- type ClientToFrontend
- func (*ClientToFrontend) Descriptor() ([]byte, []int)
- func (this *ClientToFrontend) Equal(that interface{}) bool
- func (m *ClientToFrontend) GetClientID() string
- func (m *ClientToFrontend) GetHttpResponse() *httpgrpc.HTTPResponse
- func (this *ClientToFrontend) GoString() string
- func (m *ClientToFrontend) Marshal() (dAtA []byte, err error)
- func (m *ClientToFrontend) MarshalTo(dAtA []byte) (int, error)
- func (m *ClientToFrontend) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ClientToFrontend) ProtoMessage()
- func (m *ClientToFrontend) Reset()
- func (m *ClientToFrontend) Size() (n int)
- func (this *ClientToFrontend) String() string
- func (m *ClientToFrontend) Unmarshal(dAtA []byte) error
- func (m *ClientToFrontend) XXX_DiscardUnknown()
- func (m *ClientToFrontend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ClientToFrontend) XXX_Merge(src proto.Message)
- func (m *ClientToFrontend) XXX_Size() int
- func (m *ClientToFrontend) XXX_Unmarshal(b []byte) error
- type Config
- type Frontend
- func (f *Frontend) CheckReady(_ context.Context) error
- func (f *Frontend) Close()
- func (f *Frontend) Handler() http.Handler
- func (f *Frontend) Process(server Frontend_ProcessServer) error
- func (f *Frontend) RoundTrip(r *http.Request) (*http.Response, error)
- func (f *Frontend) RoundTripGRPC(ctx context.Context, req *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error)
- func (f *Frontend) Wrap(trw Tripperware)
- type FrontendClient
- type FrontendServer
- type FrontendToClient
- func (*FrontendToClient) Descriptor() ([]byte, []int)
- func (this *FrontendToClient) Equal(that interface{}) bool
- func (m *FrontendToClient) GetHttpRequest() *httpgrpc.HTTPRequest
- func (m *FrontendToClient) GetType() Type
- func (this *FrontendToClient) GoString() string
- func (m *FrontendToClient) Marshal() (dAtA []byte, err error)
- func (m *FrontendToClient) MarshalTo(dAtA []byte) (int, error)
- func (m *FrontendToClient) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FrontendToClient) ProtoMessage()
- func (m *FrontendToClient) Reset()
- func (m *FrontendToClient) Size() (n int)
- func (this *FrontendToClient) String() string
- func (m *FrontendToClient) Unmarshal(dAtA []byte) error
- func (m *FrontendToClient) XXX_DiscardUnknown()
- func (m *FrontendToClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FrontendToClient) XXX_Merge(src proto.Message)
- func (m *FrontendToClient) XXX_Size() int
- func (m *FrontendToClient) XXX_Unmarshal(b []byte) error
- type Frontend_ProcessClient
- type Frontend_ProcessServer
- type Limits
- type RoundTripFunc
- type Tripperware
- type Type
- type UnimplementedFrontendServer
- type WorkerConfig
Constants ¶
const (
// StatusClientClosedRequest is the status code for when a client request cancellation of an http request
StatusClientClosedRequest = 499
)
Variables ¶
var (
ErrInvalidLengthFrontend = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowFrontend = fmt.Errorf("proto: integer overflow")
)
var Type_name = map[int32]string{
0: "HTTP_REQUEST",
1: "GET_ID",
}
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) 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) 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_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) 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).
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) 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) 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_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.
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)
type UnimplementedFrontendServer ¶ added in v0.7.0
type UnimplementedFrontendServer struct {
}
UnimplementedFrontendServer can be embedded to have forward compatible implementations.
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.