http

package
v1.1.0-rc-1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package http implements an admission webhook handler.

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "http_requests_total",
			Help: "Count of all HTTP requests processed, labeled by route, method and status code.",
		},
		[]string{"route", "method", "status_code"},
	)

	RequestDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "http_request_duration_seconds",
			Help:    "Histogram of request durations, labeled by route, method and status code.",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"route", "method", "status_code"},
	)
)

Define your Prometheus metrics

Functions

func LoggingMiddlewareWrapper

func LoggingMiddlewareWrapper(next http.Handler) http.Handler

func MetricsMiddlewareWrapper

func MetricsMiddlewareWrapper(next http.Handler) http.Handler

func NewServer

func NewServer(cfg *config.Settings, routes []RouteSegment, admissionRoutes ...AdmissionRouteSegment) *http.Server

NewServer creates and return a http.Server

Types

type AdmissionRouteSegment

type AdmissionRouteSegment struct {
	Route string
	Hook  hook.Handler
}

type RouteSegment

type RouteSegment struct {
	Route string
	Hook  http.Handler
}

Directories

Path Synopsis
Package handler admission webhook handlers (hook.Handler) for various resource types.
Package handler admission webhook handlers (hook.Handler) for various resource types.
Package hook contains structures and interfaces for implementing admission webhooks handlers.
Package hook contains structures and interfaces for implementing admission webhooks handlers.

Jump to

Keyboard shortcuts

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