handler

package
Version: v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 39 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(_ context.Context, t Throttler, transport http.RoundTripper, usePassthroughLb bool, logger *zap.SugaredLogger) http.Handler

New constructs a new http.Handler that deals with revision activation.

func NewContextHandler

func NewContextHandler(ctx context.Context, next http.Handler, store *activatorconfig.Store) http.Handler

NewContextHandler creates a handler that extracts the necessary context from the request and makes it available on the request's context.

func NewTracingHandler

func NewTracingHandler(next http.Handler) http.HandlerFunc

NewTracingHandler creates a wrapper around tracing.HTTPSpanMiddleware that completely bypasses said handler when tracing is disabled via the Activator's configuration.

func RevIDFrom

func RevIDFrom(ctx context.Context) types.NamespacedName

RevIDFrom retrieves the the revisionID from the context.

func RevisionFrom

func RevisionFrom(ctx context.Context) *v1.Revision

RevisionFrom retrieves the Revision object from the context.

func WithRevisionAndID

func WithRevisionAndID(ctx context.Context, rev *v1.Revision, revID types.NamespacedName) context.Context

WithRevisionAndID attaches the Revision and the ID to the context.

Types

type ConcurrencyReporter

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

ConcurrencyReporter reports stats based on incoming requests and ticks.

func NewConcurrencyReporter

func NewConcurrencyReporter(ctx context.Context, podName string, statCh chan []asmetrics.StatMessage) *ConcurrencyReporter

NewConcurrencyReporter creates a ConcurrencyReporter which listens to incoming ReqEvents on reqCh and ticks on reportCh and reports stats on statCh.

func (*ConcurrencyReporter) Handler

func (cr *ConcurrencyReporter) Handler(next http.Handler) http.HandlerFunc

Handler returns a handler that records requests coming in/being finished in the stats machinery.

func (*ConcurrencyReporter) Run

func (cr *ConcurrencyReporter) Run(stopCh <-chan struct{})

Run runs until stopCh is closed and processes events on all incoming channels.

type HealthHandler

type HealthHandler struct {
	HealthCheck func() error
	NextHandler http.Handler
	Logger      *zap.SugaredLogger
}

HealthHandler handles responding to kubelet probes with a provided health check.

func (*HealthHandler) ServeHTTP

func (h *HealthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MetricHandler

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

MetricHandler is a handler that records request metrics.

func NewMetricHandler

func NewMetricHandler(podName string, next http.Handler) *MetricHandler

NewMetricHandler creates a handler that collects and reports request metrics.

func (*MetricHandler) ServeHTTP

func (h *MetricHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProbeHandler

type ProbeHandler struct {
	NextHandler http.Handler
}

ProbeHandler handles responding to Knative internal network probes.

func (*ProbeHandler) ServeHTTP

func (h *ProbeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Throttler

type Throttler interface {
	Try(ctx context.Context, revID types.NamespacedName, fn func(string) error) error
}

Throttler is the interface that Handler calls to Try to proxy the user request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto