Documentation ¶
Overview ¶
Package httpsec defines the HTTP operation that can be listened to using dyngo's operation instrumentation. It serves as an abstract representation of HTTP handler calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandlerOperationArgs ¶
type HandlerOperationArgs struct { Method string Host string RemoteAddr string Path string IsTLS bool Span ddtrace.Span // RequestURI corresponds to the address `server.request.uri.raw` RequestURI string // Headers corresponds to the address `server.request.headers.no_cookies` Headers map[string][]string // Cookies corresponds to the address `server.request.cookies` Cookies map[string][]string // Query corresponds to the address `server.request.query` Query url.Values }
HandlerOperationArgs is the HTTP handler operation arguments.
func MakeHandlerOperationArgs ¶
func MakeHandlerOperationArgs(r *http.Request, span ddtrace.Span) HandlerOperationArgs
MakeHandlerOperationArgs creates the HandlerOperationArgs out of a standard http.Request along with the given current span. It returns an empty structure when appsec is disabled.
type HandlerOperationRes ¶
type HandlerOperationRes struct { // Status corresponds to the address `server.response.status` Status int }
HandlerOperationRes is the HTTP handler operation results.
type OnHandlerOperationFinish ¶
type OnHandlerOperationFinish func(dyngo.Operation, HandlerOperationRes)
OnHandlerOperationFinish function type, called when an HTTP handler operation finishes.
func (OnHandlerOperationFinish) Call ¶
func (f OnHandlerOperationFinish) Call(op dyngo.Operation, v interface{})
Call the underlying event listener function by performing the type-assertion on v whose type is the one returned by ListenedType().
func (OnHandlerOperationFinish) ListenedType ¶
func (OnHandlerOperationFinish) ListenedType() reflect.Type
ListenedType returns the type a OnHandlerOperationFinish event listener listens to, which is the HandlerOperationRes type.
type OnHandlerOperationStart ¶
type OnHandlerOperationStart func(dyngo.Operation, HandlerOperationArgs)
OnHandlerOperationStart function type, called when an HTTP handler operation starts.
func (OnHandlerOperationStart) Call ¶
func (f OnHandlerOperationStart) Call(op dyngo.Operation, v interface{})
Call the underlying event listener function by performing the type-assertion on v whose type is the one returned by ListenedType().
func (OnHandlerOperationStart) ListenedType ¶
func (OnHandlerOperationStart) ListenedType() reflect.Type
ListenedType returns the type a OnHandlerOperationStart event listener listens to, which is the HandlerOperationArgs type.
type Operation ¶
type Operation struct {
*dyngo.OperationImpl
}
Operation type representing an HTTP operation. It must be created with StartOperation() and finished with its Finish().
func StartOperation ¶
func StartOperation(args HandlerOperationArgs, parent dyngo.Operation) Operation
StartOperation starts an HTTP handler operation, along with the given arguments and parent operation, and emits a start event up in the operation stack. When parent is nil, the operation is linked to the global root operation.
func (Operation) Finish ¶
func (op Operation) Finish(res HandlerOperationRes)
Finish the HTTP handler operation, along with the given results, and emits a finish event up in the operation stack.