transport

package
v0.0.0-...-fbfa8e9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 28 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
	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, io.ReadCloser, 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 wait on in-flight requests and log slow queries, all other logic is inside the RoundTripper.

func NewHandler

NewHandler creates a new frontend handler.

func (*Handler) ServeHTTP

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

func (*Handler) Stop

func (f *Handler) Stop()

Stop makes f enter stopped mode and wait on in-flight requests.

type HandlerConfig

type HandlerConfig struct {
	LogQueriesLongerThan     time.Duration          `yaml:"log_queries_longer_than"`
	LogQueryRequestHeaders   flagext.StringSliceCSV `yaml:"log_query_request_headers" category:"advanced"`
	MaxBodySize              int64                  `yaml:"max_body_size" category:"advanced"`
	QueryStatsEnabled        bool                   `yaml:"query_stats_enabled" category:"advanced"`
	ActiveSeriesWriteTimeout time.Duration          `yaml:"active_series_write_timeout" category:"experimental"`
}

HandlerConfig is a config for the handler.

func (*HandlerConfig) RegisterFlags

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

Jump to

Keyboard shortcuts

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