server

package
v0.0.0-...-da76615 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package server provides a preconfigured HTTP server with diagnostic hooks.

Index

Constants

This section is empty.

Variables

Set is a Wire provider set that produces a *Server given the fields of Options. This set might add new inputs over time, but they can always be the zero value.

Functions

This section is empty.

Types

type Options

type Options struct {
	RequestLogger requestlog.Logger
	HealthChecks  []health.Checker

	TraceExporter         trace.Exporter
	DefaultSamplingPolicy trace.Sampler
}

Options is the set of optional parameters.

type Server

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

Server is a preconfigured HTTP server with diagnostic hooks. The zero value is a server with the default options.

func New

func New(opts *Options) *Server

New creates a new server. New(nil) is the same as new(Server).

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe(addr string, h http.Handler) error

ListenAndServe is a wrapper to use wherever http.ListenAndServe is used. It wraps the passed-in http.Handler with a handler that handles tracing and request logging. If the handler is nil, then http.DefaultServeMux will be used. A configured Requestlogger will log all requests except HealthChecks.

Directories

Path Synopsis
Package sdserver provides the diagnostic hooks for a server using Stackdriver.
Package sdserver provides the diagnostic hooks for a server using Stackdriver.
Package xrayserver provides the diagnostic hooks for a server using AWS X-Ray.
Package xrayserver provides the diagnostic hooks for a server using AWS X-Ray.

Jump to

Keyboard shortcuts

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