server

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HTTPRequestsTotal counts total HTTP requests by method and path.
	HTTPRequestsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "vocnet_http_requests_total",
			Help: "Total number of HTTP requests",
		},
		[]string{"method", "path", "status"},
	)

	// HTTPRequestDuration tracks HTTP request latency.
	HTTPRequestDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "vocnet_http_request_duration_seconds",
			Help:    "HTTP request latency in seconds",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"method", "path"},
	)
)

Functions

func LoggerWithConfig added in v0.3.0

func LoggerWithConfig(cfg *config.Config) (connect.UnaryInterceptorFunc, error)

LoggerWithConfig creates a logger interceptor with configuration support

func MetricsHandler added in v0.8.0

func MetricsHandler() http.Handler

MetricsHandler returns an http.Handler for the /metrics endpoint.

func NewAccessLogger added in v0.3.0

func NewAccessLogger(cfg *config.Config) (*slog.Logger, error)

NewAccessLogger creates a slog logger for access logs with file output support

func NewLogger

func NewLogger(cfg *config.Config) (*slog.Logger, error)

NewLogger builds a configured slog logger for business logs.

Types

type Server

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

Server represents the application server

func NewServer

NewServer creates a new server instance from pre-wired dependencies.

func (*Server) RegisterMetricsHandler added in v0.8.0

func (s *Server) RegisterMetricsHandler(handler http.Handler)

RegisterMetricsHandler registers the metrics endpoint.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server

func (*Server) StartGRPC

func (s *Server) StartGRPC() error

StartGRPC starts the gRPC server

func (*Server) StartHTTP

func (s *Server) StartHTTP() error

StartHTTP starts the HTTP gateway server

Jump to

Keyboard shortcuts

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