Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HTTPHeaderClientID = "X-Bacalhau-Client-ID"
View Source
var HTTPHeaderJobID = "X-Bacalhau-Job-ID"
Functions ¶
This section is empty.
Types ¶
type HTTPHandlerWrapper ¶
type HTTPHandlerWrapper struct {
// contains filtered or unexported fields
}
func NewHTTPHandlerWrapper ¶
func NewHTTPHandlerWrapper( nodeID string, httpHandler http.Handler, requestInfoHandler RequestInfoHandler) *HTTPHandlerWrapper
func (*HTTPHandlerWrapper) ServeHTTP ¶
func (wrapper *HTTPHandlerWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)
An HTTP handler that triggers another handler, capturs info about the request and calls request info handler.
type HTTPRequestInfo ¶
type HTTPRequestInfo struct { JobID string `json:"JobID,omitempty"` // bacalhau job id URI string `json:"URI"` // GET etc. Method string `json:"Method"` StatusCode int `json:"StatusCode"` // response code, like 200, 404 Size int64 `json:"Size"` // number of bytes of the response sent Duration int64 `json:"Duration"` // how long did it take to NodeID string `json:"NodeID"` // bacalhau node id ClientID string `json:"ClientID,omitempty"` // bacalhau client id Referer string `json:"Referer,omitempty"` Ipaddr string `json:"Ipaddr"` UserAgent string `json:"UserAgent"` }
type JSONLogHandler ¶
type JSONLogHandler struct { }
func NewJSONLogHandler ¶
func NewJSONLogHandler() *JSONLogHandler
func (*JSONLogHandler) Handle ¶
func (h *JSONLogHandler) Handle(ctx context.Context, ri *HTTPRequestInfo)
type RequestInfoHandler ¶
type RequestInfoHandler interface {
Handle(context.Context, *HTTPRequestInfo)
}
Click to show internal directories.
Click to hide internal directories.