server

package
v0.0.0-...-145cf54 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MetricsLabels = []string{
	metricsMethodLabel,
	metricsPathLabel,
	metricsCodeLabel,
}

MetricsLabels - Array of labels added to metrics:

View Source
var MetricsNames = []string{
	requestCount,
	requestDuration,
}

MetricsNames - Array of Names of the metrics:

View Source
var PathVarSub = "-"

PathVarSub replaces path variables to a same character

Functions

func LoadDiscoveredRoutes

func LoadDiscoveredRoutes(apiV1Router *mux.Router, services ServicesInterface, authMiddleware auth.JWTMiddleware, authzMiddleware auth.AuthorizationMiddleware)

func MetricsMiddleware

func MetricsMiddleware(handler http.Handler) http.Handler

MetricsMiddleware creates a new handler that collects metrics for the requests processed by the given handler.

func RegisterRoutes

func RegisterRoutes(name string, registrationFunc RouteRegistrationFunc)

func ResetMetricCollectors

func ResetMetricCollectors()

ResetMetricCollectors resets all prometheus collectors

Types

type ListenNotifier

type ListenNotifier interface {
	NotifyListening() <-chan struct{}
}

ListenNotifier is an optional interface that servers can implement to signal when they are ready to accept connections

type RouteRegistrationFunc

type RouteRegistrationFunc func(apiV1Router *mux.Router, services ServicesInterface, authMiddleware auth.JWTMiddleware, authzMiddleware auth.AuthorizationMiddleware)

type Server

type Server interface {
	Start()
	Stop() error
	Listen() (net.Listener, error)
	Serve(net.Listener)
}

func NewAPIServer

func NewAPIServer() Server

func NewHealthServer

func NewHealthServer() Server

func NewMetricsServer

func NewMetricsServer() Server

type ServicesInterface

type ServicesInterface interface {
	GetService(name string) interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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