Documentation
¶
Index ¶
- Variables
- func MustLabelValue(ctx context.Context) string
- func MustLabelValues(ctx context.Context) []string
- func NewRoutes(upstream *url.URL, label string, extractLabeler ExtractLabeler, opts ...Option) (*routes, error)
- func WithLabelValues(ctx context.Context, labels []string) context.Context
- type ExtractLabeler
- type HTTPFormEnforcer
- type HTTPHeaderEnforcer
- type Option
- func WithActiveAlerts() Option
- func WithEnabledLabelsAPI() Option
- func WithErrorOnReplace() Option
- func WithHTTPTimeout(d time.Duration) Option
- func WithInsecureSkipVerify() Option
- func WithLabelMatchersForRulesAPI() Option
- func WithPassthroughPaths(paths []string) Option
- func WithPrometheusRegistry(reg prometheus.Registerer) Option
- func WithPromqlBinopFillModifiers() Option
- func WithPromqlDurationExpressionParsing() Option
- func WithPromqlExperimentalFunctions() Option
- func WithPromqlExtendedRangeSelectors() Option
- func WithRegexMatch() Option
- func WithRewriteHostHeader(host string) Option
- func WithUpstreamCaCert(caCert string) Option
- func WithUpstreamClientCert(certFile, keyFile string) Option
- func WithUpstreamServerName(name string) Option
- type PromQLEnforcer
- type StaticLabelEnforcer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrQueryParse is returned when the input query is invalid. ErrQueryParse = errors.New("failed to parse query string") // ErrIllegalLabelMatcher is returned when the input query contains a conflicting label matcher. ErrIllegalLabelMatcher = errors.New("conflicting label matcher") // ErrEnforceLabel is returned when the label matchers couldn't be enforced. ErrEnforceLabel = errors.New("failed to enforce label") )
Functions ¶
func MustLabelValue ¶ added in v0.6.0
MustLabelValue returns the first (alphabetical order) label value previously stored using WithLabelValue() from the given context. Similar to MustLabelValues, it will panic if no label is found or the value is empty.
func MustLabelValues ¶ added in v0.7.0
MustLabelValues returns labels (previously stored using WithLabelValue()) from the given context. It will panic if no label is found or the value is empty.
Types ¶
type ExtractLabeler ¶ added in v0.6.0
type ExtractLabeler interface {
ExtractLabel(next http.HandlerFunc) http.Handler
}
ExtractLabeler is an HTTP handler that extract the label value to be enforced from the HTTP request. If a valid label value is found, it should store it in the request's context. Otherwise it should return an error in the HTTP response (usually 400 or 500).
type HTTPFormEnforcer ¶ added in v0.6.0
type HTTPFormEnforcer struct {
ParameterName string
}
HTTPFormEnforcer enforces a label value extracted from the HTTP form and query parameters.
func (HTTPFormEnforcer) ExtractLabel ¶ added in v0.6.0
func (hff HTTPFormEnforcer) ExtractLabel(next http.HandlerFunc) http.Handler
ExtractLabel implements the ExtractLabeler interface.
type HTTPHeaderEnforcer ¶ added in v0.6.0
HTTPHeaderEnforcer enforces a label value extracted from the HTTP headers.
func (HTTPHeaderEnforcer) ExtractLabel ¶ added in v0.6.0
func (hhe HTTPHeaderEnforcer) ExtractLabel(next http.HandlerFunc) http.Handler
ExtractLabel implements the ExtractLabeler interface.
type Option ¶ added in v0.3.0
type Option interface {
// contains filtered or unexported methods
}
func WithActiveAlerts ¶ added in v0.11.0
func WithActiveAlerts() Option
WithActiveAlerts causes the proxy to return rules with active alerts.