srvhttp

package module
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config[T http.Handler] struct {
	Label common.Label
	Host  common.Host
	Port  common.Port
}

Config is the HTTP server spec (Label, Host, Port); ecfg fills before Build.

func (*Config[T]) Build

func (cfg *Config[T]) Build() (any, error)

type HTTPMetrics added in v0.21.0

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

HTTPMetrics is a singleton pool resource: contributor + shared slok Recorder for all srv-http servers.

func (*HTTPMetrics) AddInflightRequests added in v0.21.0

func (m *HTTPMetrics) AddInflightRequests(ctx context.Context, props metrics.HTTPProperties, quantity int)

func (*HTTPMetrics) ObserveHTTPRequestDuration added in v0.21.0

func (m *HTTPMetrics) ObserveHTTPRequestDuration(ctx context.Context, props metrics.HTTPReqProperties, duration time.Duration)

func (*HTTPMetrics) ObserveHTTPResponseSize added in v0.21.0

func (m *HTTPMetrics) ObserveHTTPResponseSize(ctx context.Context, props metrics.HTTPReqProperties, sizeBytes int64)

func (*HTTPMetrics) RegisterMetrics added in v0.21.0

func (m *HTTPMetrics) RegisterMetrics(reg *prometheus.Registry) error

type MetricsContributor added in v0.21.0

type MetricsContributor interface {
	RegisterMetrics(reg *prometheus.Registry) error
}

MetricsContributor registers HTTP metrics collectors into a shared registry. Same method signature as github.com/omcrgnt/ops/metrics.MetricsContributor.

type Server added in v0.22.0

type Server[T http.Handler] struct {
	http.Server
	// contains filtered or unexported fields
}

Server is a catalog slot for an HTTP server bound to handler type T. Zero value implements app.Configurable via BuildConfig; materialized *Server[T] is the runtime resource.

func (Server[T]) BuildConfig added in v0.22.0

func (Server[T]) BuildConfig() (app.Materializer, error)

func (*Server[T]) Close added in v0.22.0

func (t *Server[T]) Close(ctx context.Context) error

func (*Server[T]) Deps added in v0.22.0

func (r *Server[T]) Deps() []any

func (*Server[T]) HealthCheck added in v0.22.0

func (t *Server[T]) HealthCheck(_ context.Context) error

func (*Server[T]) Inject added in v0.22.0

func (r *Server[T]) Inject(args []any)

func (*Server[T]) Start added in v0.22.0

func (t *Server[T]) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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