Documentation ¶
Index ¶
- func LoggerForRequest(r *http.Request) (*log.Logger, bool)
- type ClientMiddleware
- type Doer
- type Error
- type ResponseWriter
- type ServerMiddleware
- func (m *ServerMiddleware) Logging(next http.HandlerFunc) http.HandlerFunc
- func (m *ServerMiddleware) Metrics(next http.HandlerFunc) http.HandlerFunc
- func (m *ServerMiddleware) RequestID(next http.HandlerFunc) http.HandlerFunc
- func (m *ServerMiddleware) Tracing(next http.HandlerFunc) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientMiddleware ¶ added in v0.2.8
type ClientMiddleware struct {
// contains filtered or unexported fields
}
ClientMiddleware is an http client middleware for logging, metrics, tracing, etc.
func NewClientMiddleware ¶ added in v0.2.8
func NewClientMiddleware(logger *log.Logger, mf *metrics.Factory, tracer opentracing.Tracer) *ClientMiddleware
NewClientMiddleware creates a new instance of http client middleware
func (*ClientMiddleware) Logging ¶ added in v0.2.8
func (m *ClientMiddleware) Logging(next Doer) Doer
Logging takes care of logging for outgoing http requests Request id will be read from reqeust context if present
func (*ClientMiddleware) Metrics ¶ added in v0.2.8
func (m *ClientMiddleware) Metrics(next Doer) Doer
Metrics takes care of metrics for outgoing http requests
func (*ClientMiddleware) RequestID ¶ added in v0.2.8
func (m *ClientMiddleware) RequestID(next Doer) Doer
RequestID ensures outgoing requests have unique ids This middleware ensures the request headers and context have a unique id A new request id will be generated if needed
func (*ClientMiddleware) Tracing ¶ added in v0.2.8
func (m *ClientMiddleware) Tracing(next Doer) Doer
Tracing takes care of tracing for outgoing http requests Trace information will be read from reqeust context if present
type ResponseWriter ¶
type ResponseWriter struct { http.ResponseWriter StatusCode int StatusClass string }
ResponseWriter extends the functionality of standard http.ResponseWriter
func NewResponseWriter ¶
func NewResponseWriter(rw http.ResponseWriter) *ResponseWriter
NewResponseWriter creates a new response writer
func (*ResponseWriter) WriteHeader ¶
func (r *ResponseWriter) WriteHeader(statusCode int)
WriteHeader overrides the default implementation of http.WriteHeader
type ServerMiddleware ¶ added in v0.2.8
type ServerMiddleware struct {
// contains filtered or unexported fields
}
ServerMiddleware is an http server middleware for logging, metrics, tracing, etc.
func NewServerMiddleware ¶ added in v0.2.8
func NewServerMiddleware(logger *log.Logger, mf *metrics.Factory, tracer opentracing.Tracer) *ServerMiddleware
NewServerMiddleware creates a new instance of http server middleware
func (*ServerMiddleware) Logging ¶ added in v0.2.8
func (m *ServerMiddleware) Logging(next http.HandlerFunc) http.HandlerFunc
Logging takes care of logging for incoming http requests Request id will be read from reqeust headers if present
func (*ServerMiddleware) Metrics ¶ added in v0.2.8
func (m *ServerMiddleware) Metrics(next http.HandlerFunc) http.HandlerFunc
Metrics takes care of metrics for incoming http requests
func (*ServerMiddleware) RequestID ¶ added in v0.2.8
func (m *ServerMiddleware) RequestID(next http.HandlerFunc) http.HandlerFunc
RequestID ensures incoming requests have unique ids This middleware ensures the request headers and context have a unique id A new request id will be generated if needed
func (*ServerMiddleware) Tracing ¶ added in v0.2.8
func (m *ServerMiddleware) Tracing(next http.HandlerFunc) http.HandlerFunc
Tracing takes care of tracing for incoming http requests Trace information will be read from reqeust headers if present