Documentation
¶
Index ¶
- func HTTPHandler(serverName string, log *slog.Logger) func(http.Handler) http.Handler
- func HTTPHandlerFunc(serverAddress string, log *slog.Logger) func(http.HandlerFunc) http.HandlerFunc
- func NewLogger(endpoint, header, name string, attrs ...Attr) (func(context.Context) error, error)
- func NewMeter(endpoint, header, name string, attrs ...Attr) (func(context.Context) error, error)
- func NewTracer(endpoint, header, name string, attrs ...Attr) (func(context.Context) error, error)
- func ShutdownProvider(ctx context.Context) error
- type Attr
- type Provider
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPHandler ¶
HTTPHandler returns an HTTP middleware that instruments requests with otelhttp and logs a request summary after the handler completes.
func HTTPHandlerFunc ¶
func HTTPHandlerFunc(serverAddress string, log *slog.Logger) func(http.HandlerFunc) http.HandlerFunc
HTTPHandlerFunc is like HTTPHandler but wraps http.HandlerFunc directly. This is useful for routers that use HandlerFunc.
func ShutdownProvider ¶ added in v1.6.21
Types ¶
type Provider ¶ added in v1.6.21
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶ added in v1.6.21
type ResponseWriter ¶ added in v1.6.21
type ResponseWriter interface {
http.ResponseWriter
// Status returns the status code of the response or 0 if the response has
// not been written
Status() int
// Written returns whether or not the ResponseWriter has been written.
Written() bool
// Size returns the size of the response body.
Size() int
}
ResponseWriter is a wrapper around http.ResponseWriter that provides extra information about the response. It is recommended that middleware handlers use this construct to wrap a responsewriter if the functionality calls for it.
func NewResponseWriter ¶ added in v1.6.21
func NewResponseWriter(rw http.ResponseWriter) ResponseWriter
NewResponseWriter creates a ResponseWriter that wraps a http.ResponseWriter
Click to show internal directories.
Click to hide internal directories.