Documentation
¶
Overview ¶
Package tee provides a unix-like tee feature for routing.
Using this filter, the request will be sent to a "shadow" backend in addition to the main backend of the route.
Example:
r: * -> tee("https://audit-logging.example.org") -> "https://foo.example.org";
This will send an identical request for foo.example.org to audit-logging.example.org. Another use case could be using it for benchmarking a new backend with some real traffic
The above route will forward the request to https://foo.example.org as it normally would do, but in addition to that, it will send an identical request to https://audit-logging.example.org. The request sent to https://audit-logging.example.org will receive the same method and headers, and a copy of the body stream. The tee response is ignored.
It is possible to change the path of the tee request, in a similar way to the modPath filter:
Path("/api/v1") -> tee("https://api.example.org", "^/v1", "/v2" ) -> "http://api.example.org"
In the above example, one can test how a new version of an API would behave on incoming requests.
Index ¶
Constants ¶
const ( // Deprecated, use filters.TeeName instead Name = filters.TeeName // Deprecated, use filters.TeeName instead DeprecatedName = "Tee" // Deprecated, use filters.TeenfName instead NoFollowName = filters.TeenfName )
const FilterName = filters.TeeLoopbackName
FilterName is the filter name Deprecated, use filters.TeeLoopbackName instead
const (
// ShadowTrafficHeader marks outgoing requests as shadow traffic
ShadowTrafficHeader = "X-Skipper-Shadow-Traffic"
)
Variables ¶
This section is empty.
Functions ¶
func NewTee ¶
NewTee returns a new tee filter Spec, whose instances execute the exact same Request against a shadow backend. parameters: shadow backend url, optional - the path(as a regexp) to match and the replacement string.
Name: "tee".
func NewTeeDeprecated ¶
NewTeeDeprecated returns a new tee filter Spec, whose instances execute the exact same Request against a shadow backend. parameters: shadow backend url, optional - the path(as a regexp) to match and the replacement string.
This version uses the capitalized version of the filter name and to follow conventions, it is deprecated and NewTee() (providing the name "tee") should be used instead.
Name: "Tee".
func NewTeeLoopback ¶ added in v0.11.113
func NewTeeNoFollow ¶ added in v0.9.33
NewTeeNoFollow returns a new tee filter Spec, whose instances execute the exact same Request against a shadow backend. It does not follow the redirects from the backend. parameters: shadow backend url, optional - the path(as a regexp) to match and the replacement string.
Name: "teenf".
func NewTeeResponse ¶ added in v0.24.28
NewTeeResponse returns a new teeResponse filter Spec, whose instances create a Request against a shadow backend with the response body streamed to the client. parameters: shadow backend url
Name: "teeResponse".
func WithOptions ¶ added in v0.9.35
WithOptions returns a new tee filter Spec, whose instances execute the exact same Request against a shadow backend with given options. Available options are nofollow and Timeout for http client. For more available options see Options type. parameters: shadow backend url, optional - the path(as a regexp) to match and the replacement string.
Types ¶
type Options ¶ added in v0.9.35
type Options struct {
// NoFollow specifies whether or not tee should follow redirects.
// If NoFollow is true, it won't follow; otherwise, it will.
NoFollow bool
// Timeout specifies a time limit for requests made by tee filter.
Timeout time.Duration
// Tracer is the opentracing tracer to use in the client
Tracer opentracing.Tracer
// OpenTracingClientTraceByTag instead of events use span Tags/Attributes
OpenTracingClientTraceByTag bool
// MaxIdleConns defaults to 100
MaxIdleConns int
// MaxIdleConnsPerHost defaults to 100
MaxIdleConnsPerHost int
// IdleConnTimeout defaults to 30s
IdleConnTimeout time.Duration
}
Options for tee filter.