Documentation ¶
Overview ¶
Package clienttiming gives an HTTP client for go-server-timing middleware.
It provides:
An HTTP `Client` or `RoundTripper`, fully compatible with Go's standard library. Automatically time HTTP requests sent from an HTTP handler. Collects all timing headers from upstream servers. Customize timing headers according to the request, response and error of the HTTP round trip.
Index ¶
Constants ¶
const KeySource = "source"
KeySource is the key in the metric in which the source name will be stored
Variables ¶
This section is empty.
Functions ¶
func DefaultDesc ¶
DefaultDesc set the metric description as the request method and path
func DefaultMetric ¶
DefaultMetric set the metric name as the request host
func DefaultUpdate ¶
DefaultUpdate sets status code in metric if there was no error, otherwise it sets the error text.
func InsertMetrics ¶
InsertMetrics inserts to servertiming header metrics from an HTTP header of another request They are prepended since they happened before the metrics of the header itself
Types ¶
type Option ¶
type Option func(*Timer)
Option is timer-timing mockTransport option function
func WithDesc ¶
WithDesc sets the desc function which defines the metric description from the request
func WithMetric ¶
WithMetric sets the metric function which defines the metric name from the request
func WithName ¶
WithName updates the source key in the metric to this name It is used to give a name for the timer
func WithTransport ¶
func WithTransport(inner http.RoundTripper) Option
WithTransport sets the inner Client for the request
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer constructs instrumented clients for server-timing