Documentation
¶
Overview ¶
Package proxy contains reverse-proxy routing and capture middleware.
Index ¶
- func BodyCaptureMiddleware(options BodyCaptureOptions, sink BodyCaptureSink, next http.Handler) http.Handler
- func IsSSE(headers http.Header) bool
- func LoggingMiddleware(logger *slog.Logger, next http.Handler) http.Handler
- func NewHandler(routes []Route, logger *slog.Logger, next http.Handler) (http.Handler, error)
- func NewHandlerWithOptions(routes []Route, logger *slog.Logger, next http.Handler, options HandlerOptions) (http.Handler, error)
- type BodyCaptureOptions
- type BodyCaptureSink
- type CapturedExchange
- type HandlerOptions
- type Route
- type Router
- type StreamBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyCaptureMiddleware ¶
func BodyCaptureMiddleware(options BodyCaptureOptions, sink BodyCaptureSink, next http.Handler) http.Handler
func LoggingMiddleware ¶
func NewHandler ¶
Types ¶
type BodyCaptureOptions ¶
type BodyCaptureSink ¶
type BodyCaptureSink func(*CapturedExchange)
type CapturedExchange ¶
type CapturedExchange struct {
// Context carries the request context so downstream consumers (e.g. trace
// enqueue) can create child spans of the HTTP request span.
Context context.Context
Method string
Path string
StatusCode int
RequestHeaders http.Header
RequestBody []byte
RequestBodyTruncated bool
ResponseHeaders http.Header
ResponseBody []byte
ResponseBodyTruncated bool
Streaming bool
StreamChunks int
TimeToFirstTokenMS int64
TimeToFirstTokenUS int64
DurationMS int64
GatewayOrgID string
GatewayWorkspaceID string
GatewayKeyID string
GatewayTeam string
GatewayRole string
CorrelationID string
}
type HandlerOptions ¶
type HandlerOptions struct {
Transport http.RoundTripper
}
type Route ¶
func DefaultRoutes ¶
func DefaultRoutes() []Route
type StreamBuffer ¶
type StreamBuffer struct {
// contains filtered or unexported fields
}
func (*StreamBuffer) Add ¶
func (b *StreamBuffer) Add(chunk []byte)
Add appends an immutable copy of each chunk so captured streaming traces preserve exact wire ordering without retaining caller-owned buffers.
func (*StreamBuffer) Bytes ¶
func (b *StreamBuffer) Bytes() []byte
func (*StreamBuffer) Count ¶
func (b *StreamBuffer) Count() int
func (*StreamBuffer) Truncated ¶
func (b *StreamBuffer) Truncated() bool
Click to show internal directories.
Click to hide internal directories.