Documentation ¶
Overview ¶
Package logreplay Log Replay Plugin
Index ¶
- Variables
- type LogReplay
- func (lr *LogReplay) CopyRequest(ctx context.Context, fctx *fasthttp.RequestCtx, opts *Options) (*fasthttp.Request, error)
- func (lr *LogReplay) Replay(ctx context.Context, newReq *fasthttp.Request, opts *Options) error
- func (lr *LogReplay) ServerFilter(ctx context.Context, req interface{}, handler filter.ServerHandleFunc) (interface{}, error)
- type Options
- type Plugin
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConnPoolSize = 1000
DefaultConnPoolSize default connection pool size
View Source
var New = func() (*LogReplay, error) { l := &LogReplay{ ConnPool: fhttp.NewConnPool(DefaultConnPoolSize), } return l, nil }
New creates a new log replay
Functions ¶
This section is empty.
Types ¶
type LogReplay ¶
LogReplay traffic replay
func (*LogReplay) CopyRequest ¶
func (lr *LogReplay) CopyRequest(ctx context.Context, fctx *fasthttp.RequestCtx, opts *Options) (*fasthttp.Request, error)
CopyRequest copies the request
func (*LogReplay) ServerFilter ¶
func (lr *LogReplay) ServerFilter(ctx context.Context, req interface{}, handler filter.ServerHandleFunc) (interface{}, error)
ServerFilter server interceptor
type Options ¶
type Options struct { // Traffic replay ratio, in percentage. For example, 0.01 represents 1 in 10,000. Scale float64 `yaml:"scale" json:"scale"` // Whether to pass through the original response body. If true, the original response body will be passed through. // For POST requests: // Content-Type: application/json, the original response body will be added as a string field "origin_rsp_body" // in the original JSON request body. // Content-Type: application/x-www-form-urlencoded, the original response body will be added as a URL-encoded // field "origin_rsp_body" in the original query request body. // For other requests (GET, etc.), the original request will be appended to the query as a URL-encoded // field "origin_rsp_body". PassThroughResponse bool `yaml:"pass_through_response"` // Timeout in milliseconds; default is 500 milliseconds. Timeout int `yaml:"timeout"` }
Options plugin configuration
Click to show internal directories.
Click to hide internal directories.