Documentation
¶
Overview ¶
Package instafasthttp provides Instana instrumentation for fasthttp package.
Index ¶
Constants ¶
const Version = "0.7.0"
Version is the instrumentation module semantic version
Variables ¶
This section is empty.
Functions ¶
func RoundTripper ¶
func RoundTripper(ctx context.Context, sensor instana.TracerLogger, original fasthttp.RoundTripper) fasthttp.RoundTripper
RoundTripper wraps an existing fasthttp.RoundTripper and injects the tracing headers into the outgoing request. If the original RoundTripper is nil, the fasthttp.DefaultTransport will be used.
func TraceHandler ¶
func TraceHandler(sensor instana.TracerLogger, routeID, pathTemplate string, handler fasthttp.RequestHandler) fasthttp.RequestHandler
TraceHandler adds Instana instrumentation to the fasthttp.RequestHandler
func UserContext ¶
func UserContext(c *fasthttp.RequestCtx) context.Context
UserContext returns a context implementation set by the user earlier. If not set, it returns a context.Context derived from *fasthttp.RequestCtx.
Types ¶
type Client ¶ added in v0.2.0
type Client interface { // Get returns the status code and body of url. // // The contents of dst will be replaced by the body and returned, if the dst // is too small a new slice will be allocated. // // The function follows redirects. Use Do* for manually handling redirects. Get(dst []byte, url string) (statusCode int, body []byte, err error) // GetTimeout returns the status code and body of url. // // The contents of dst will be replaced by the body and returned, if the dst // is too small a new slice will be allocated. // // The function follows redirects. Use Do* for manually handling redirects. // // ErrTimeout error is returned if url contents couldn't be fetched // during the given timeout. GetTimeout(dst []byte, url string, timeout time.Duration) (statusCode int, body []byte, err error) // GetDeadline returns the status code and body of url. // // The contents of dst will be replaced by the body and returned, if the dst // is too small a new slice will be allocated. // // The function follows redirects. Use Do* for manually handling redirects. // // ErrTimeout error is returned if url contents couldn't be fetched // until the given deadline. GetDeadline(dst []byte, url string, deadline time.Time) (statusCode int, body []byte, err error) // Post sends POST request to the given url with the given POST arguments. // // The contents of dst will be replaced by the body and returned, if the dst // is too small a new slice will be allocated. // // The function follows redirects. Use Do* for manually handling redirects. // // Empty POST body is sent if postArgs is nil. Post(dst []byte, url string, postArgs *fasthttp.Args) (statusCode int, body []byte, err error) // CloseIdleConnections closes any connections which were previously // connected from previous requests but are now sitting idle in a // "keep-alive" state. It does not interrupt any connections currently // in use. CloseIdleConnections() // DoTimeout performs the given request and waits for response during // the given timeout duration. // // Request must contain at least non-zero RequestURI with full url (including // scheme and host) or non-zero Host header + RequestURI. // // Client determines the server to be requested in the following order: // // - from RequestURI if it contains full url with scheme and host; // - from Host header otherwise. // // The function doesn't follow redirects. Use Get* for following redirects. // // Response is ignored if resp is nil. // // ErrTimeout is returned if the response wasn't returned during // the given timeout. // Immediately returns ErrTimeout if timeout value is negative. // // ErrNoFreeConns is returned if all Client.MaxConnsPerHost connections // to the requested host are busy. // // It is recommended obtaining req and resp via Acquire // // Pass a valid context as the first argument for for span correlation DoTimeout(ctx context.Context, req *fasthttp.Request, resp *fasthttp.Response, timeout time.Duration) error // DoDeadline performs the given request and waits for response until // the given deadline. // // Request must contain at least non-zero RequestURI with full url (including // scheme and host) or non-zero Host header + RequestURI. // // Client determines the server to be requested in the following order: // // - from RequestURI if it contains full url with scheme and host; // - from Host header otherwise. // // The function doesn't follow redirects. Use Get* for following redirects. // // Response is ignored if resp is nil. // // ErrTimeout is returned if the response wasn't returned until // the given deadline. // Immediately returns ErrTimeout if the deadline has already been reached. // // ErrNoFreeConns is returned if all Client.MaxConnsPerHost connections // to the requested host are busy. // // It is recommended obtaining req and resp via AcquireRequest // and AcquireResponse in performance-critical code. // // Pass a valid context as the first argument for for span correlation DoDeadline(ctx context.Context, req *fasthttp.Request, resp *fasthttp.Response, deadline time.Time) error // DoRedirects performs the given http request and fills the given http response, // following up to maxRedirectsCount redirects. When the redirect count exceeds // maxRedirectsCount, ErrTooManyRedirects is returned. // // Request must contain at least non-zero RequestURI with full url (including // scheme and host) or non-zero Host header + RequestURI. // // Client determines the server to be requested in the following order: // // - from RequestURI if it contains full url with scheme and host; // - from Host header otherwise. // // Response is ignored if resp is nil. // // ErrNoFreeConns is returned if all DefaultMaxConnsPerHost connections // to the requested host are busy. // // It is recommended obtaining req and resp via AcquireRequest // and AcquireResponse in performance-critical code. // // Pass a valid context as the first argument for for span correlation DoRedirects(ctx context.Context, req *fasthttp.Request, resp *fasthttp.Response, maxRedirectsCount int) error // Do performs the given http request and fills the given http response. // // Request must contain at least non-zero RequestURI with full url (including // scheme and host) or non-zero Host header + RequestURI. // // Client determines the server to be requested in the following order: // // - from RequestURI if it contains full url with scheme and host; // - from Host header otherwise. // // Response is ignored if resp is nil. // // The function doesn't follow redirects. Use Get* for following redirects. // // ErrNoFreeConns is returned if all Client.MaxConnsPerHost connections // to the requested host are busy. // // It is recommended obtaining req and resp via AcquireRequest // and AcquireResponse in performance-critical code. // // Pass a valid context as the first argument for for span correlation Do(ctx context.Context, req *fasthttp.Request, resp *fasthttp.Response) error // Unwrap returns the original *fasthttp.Client Unwrap() *fasthttp.Client }
Instrumented fasthttp.Client
Most of the methods are the same as those in fasthttp.Client.
Only Do, DoTimeout, and DoDeadline differ from fasthttp.Client. Please use these methods instead of their fasthttp.Client counterparts to enable tracing.
func GetInstrumentedClient ¶ added in v0.2.0
func GetInstrumentedClient(sensor instana.TracerLogger, orgClient *fasthttp.Client) Client
GetInstrumentedClient returns an instrumented instafasthttp.Client instance derived from a *fasthttp.Client instance