transport

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 27 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// StatusClientClosedRequest is the status code for when a client request cancellation of a http request
	StatusClientClosedRequest = 499
	ServiceTimingHeaderName   = "Server-Timing"
)

Variables

This section is empty.

Functions

func AdaptGrpcRoundTripperToHTTPRoundTripper

func AdaptGrpcRoundTripperToHTTPRoundTripper(r GrpcRoundTripper) http.RoundTripper

Types

type GrpcRoundTripper

type GrpcRoundTripper interface {
	RoundTripGRPC(context.Context, *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error)
}

GrpcRoundTripper is similar to http.RoundTripper, but works with HTTP requests converted to protobuf messages.

type Handler

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

Handler accepts queries and forwards them to RoundTripper. It can log slow queries, but all other logic is inside the RoundTripper.

func NewHandler

func NewHandler(cfg HandlerConfig, roundTripper http.RoundTripper, log log.Logger, reg prometheus.Registerer) *Handler

NewHandler creates a new frontend handler.

func (*Handler) ServeHTTP

func (f *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerConfig

type HandlerConfig struct {
	LogQueriesLongerThan time.Duration `yaml:"log_queries_longer_than"`
	MaxBodySize          int64         `yaml:"max_body_size"`
	QueryStatsEnabled    bool          `yaml:"query_stats_enabled"`
}

Config for a Handler.

func (*HandlerConfig) RegisterFlags

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

type Retry added in v1.16.0

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

func NewRetry added in v1.16.0

func NewRetry(maxRetries int, reg prometheus.Registerer) *Retry

func (*Retry) Do added in v1.16.0

func (r *Retry) Do(ctx context.Context, f func() (*httpgrpc.HTTPResponse, error)) (*httpgrpc.HTTPResponse, error)

Jump to

Keyboard shortcuts

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