Version: v0.0.0-...-3f30213 Latest Latest

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 8 Imported by: 0



Package whmon provides a means to monitor various aspects of how the request and response is going.



This section is empty.


View Source
var (
	RequestId = webhelp.GenSym()


func MonitorResponse

func MonitorResponse(h http.Handler) http.Handler

MonitorResponse wraps all incoming http.ResponseWriters with a monitored ResponseWriter that keeps track of additional status information about the outgoing response. It preserves whether or not the passed in response writer is an http.Flusher, http.CloseNotifier, or an http.Hijacker. whlog.LogRequests and whfatal.Catch also do this for you.

func RequestIds

func RequestIds(h http.Handler) http.Handler

RequestIds generates a new request id for the request if one does not already exist under the Request Context Key RequestId. The RequestId can be retrieved using:

rid := whcompat.Context(req).Value(whmon.RequestId).(int64)


type ResponseWriter

type ResponseWriter interface {
	// Header, Write, and WriteHeader are exactly like http.ResponseWriter
	Header() http.Header
	Write([]byte) (int, error)

	// WroteHeader returns true if the Header was sent out. Note that this can
	// happen if only Write is called.
	WroteHeader() bool
	// StatusCode returns the HTTP status code the Header sent.
	StatusCode() int
	// Written returns the total amount of bytes successfully passed through the
	// Write call. This does not include the header.
	Written() int64

Source Files

Jump to

Keyboard shortcuts

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