Documentation
¶
Index ¶
- func ClusterID(logger log.Logger, key string, next http.HandlerFunc) http.HandlerFunc
- func ClusterIDFromContext(ctx context.Context) (string, bool)
- func ForwardHandler(logger log.Logger, forwardURL *url.URL, tenantID string, client *http.Client) http.HandlerFunc
- func InstrumentedHandler(handlerName string, next http.Handler) http.Handler
- func Ratelimit(logger log.Logger, limit time.Duration, now func() time.Time, ...) http.HandlerFunc
- func RequestLogger(logger log.Logger) func(http.Handler) http.Handler
- func Snappy(next http.HandlerFunc) http.HandlerFunc
- func Validate(logger log.Logger, baseTransforms metricfamily.Transformer, ...) http.HandlerFunc
- func WithClusterID(ctx context.Context, clusterID string) context.Context
- type AccessLogResponseWriter
- type ErrWriteLimitReached
- type PartitionedMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterID ¶
func ClusterID(logger log.Logger, key string, next http.HandlerFunc) http.HandlerFunc
ClusterID is a HTTP middleware that extracts the cluster's ID and passes it on via context.
func ClusterIDFromContext ¶
ClusterIDFromContext returns the clusterID from the context.
func ForwardHandler ¶
func ForwardHandler(logger log.Logger, forwardURL *url.URL, tenantID string, client *http.Client) http.HandlerFunc
ForwardHandler gets a request containing metric families and converts it to a remote write request forwarding it to the upstream at fowardURL.
func InstrumentedHandler ¶
InstrumentedHandler is an HTTP middleware that monitors HTTP requests and responses.
func Ratelimit ¶
func Ratelimit(logger log.Logger, limit time.Duration, now func() time.Time, next http.HandlerFunc) http.HandlerFunc
Ratelimit is a middleware that rate limits requests based on a cluster ID.
func RequestLogger ¶
RequestLogger is a middleware that logs requests.
func Snappy ¶
func Snappy(next http.HandlerFunc) http.HandlerFunc
Snappy checks HTTP headers and if Content-Ecoding is snappy it decodes the request body.
func Validate ¶
func Validate(logger log.Logger, baseTransforms metricfamily.Transformer, maxAge time.Duration, limitBytes int64, now func() time.Time, next http.HandlerFunc) http.HandlerFunc
Validate the payload of a request against given and required rules.
Types ¶
type AccessLogResponseWriter ¶
type AccessLogResponseWriter struct { http.ResponseWriter StatusCode int }
AccessLogResponseWriter wrps the responseWriter to capture the HTTP status code.
func (*AccessLogResponseWriter) WriteHeader ¶
func (a *AccessLogResponseWriter) WriteHeader(code int)
type ErrWriteLimitReached ¶
type ErrWriteLimitReached string
ErrWriteLimitReached is an error that is returned when a cluster has sent too many requests.
func (ErrWriteLimitReached) Error ¶
func (e ErrWriteLimitReached) Error() string
type PartitionedMetrics ¶
type PartitionedMetrics struct { ClusterID string Families []*clientmodel.MetricFamily }