webhelp.v1: gopkg.in/webhelp.v1/whmon Index | Files

package whmon

import "gopkg.in/webhelp.v1/whmon"

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

Index

Package Files

rid.go writer.go

Variables

var (
    RequestId = webhelp.GenSym()
)

func MonitorResponse Uses

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 Uses

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 Uses

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

    // 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
}

Package whmon imports 8 packages (graph) and is imported by 3 packages. Updated 2017-06-08. Refresh now. Tools for package owners.