handlerwrapper

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

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

Jump to

Keyboard shortcuts

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