httpserver

package
v1.0.1246-55c7eea Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 11 Imported by: 2

Documentation

Overview

Package httpserver contains helpers for creating zero-downtime REST APIs.

There are tools for: - observability (both for requests and connection info) - health checks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

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

func Load

func Load(ctx context.Context, name, addr string, handler http.Handler, sys *system.System) (*HTTPServer, error)

func New

func New(ctx context.Context, name, addr string, handler http.Handler) (s *HTTPServer, err error)

func (HTTPServer) Addr

func (s HTTPServer) Addr() string

func (*HTTPServer) MetricsProducer

func (s *HTTPServer) MetricsProducer() MetricProducer

func (*HTTPServer) Serve

func (s *HTTPServer) Serve(ctx context.Context) error

Serve the http server. On context cancellation the server is shutdown giving some time for the in flight requests to be handled.

type MetricProducer

type MetricProducer interface {
	// MetricName The name for this group of metrics
	//(Name might be cleaner, but is much more likely to conflict in implementations)
	MetricName() string
	// Gauges are instantaneous name value pairs
	Gauges(context.Context) map[string]float64
}

Directories

Path Synopsis
Package ginrouter provides a common base for configuring a Gin router instance, wiring in the standard o11y wrappers.
Package ginrouter provides a common base for configuring a Gin router instance, wiring in the standard o11y wrappers.
Package healthcheck contains a simple healthcheck handler.
Package healthcheck contains a simple healthcheck handler.

Jump to

Keyboard shortcuts

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