Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoBackend = errors.New("no backend configured")
ErrNoBackend is returned when attempting to initialize a MetricsComponent without configuring a value for the Backend tag.
Functions ¶
func New ¶
func New(ctx context.Context, source settings.Source) (func(http.RoundTripper) http.RoundTripper, error)
New is the top-level entrypoint for creating an `http.Transport` decorator that emits HTTP metrics on every `RoundTrip`.
Useful when configuring a `MetricsComponent` outside of the hierarchy of a surrounding application.
Types ¶
type MetricsComponent ¶
type MetricsComponent struct{}
MetricsComponent implements the settings.Component interface.
func (*MetricsComponent) New ¶
func (c *MetricsComponent) New(_ context.Context, conf *MetricsConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the HTTP metrics transport decorator.
If `Dependency` is zero-valued, this constructor will return an error.
If `Path` is zero-valued, this constructor adds an `httpstats.TransportOptionRequestTag` that dynamically tags the request path on each request made with the decorated `http.Transport`.
func (*MetricsComponent) Settings ¶
func (*MetricsComponent) Settings() *MetricsConfig
Settings generates a config populated with defaults.
type MetricsConfig ¶
type MetricsConfig struct { Timing string `description:"Name of overall timing metric."` DNS string `description:"Name of DNS timing metric."` TCP string `description:"Name of TCP timing metric."` ConnectionIdle string `description:"Name of idle timing metric."` TLS string `description:"Name of TLS timing metric."` WroteHeaders string `description:"Name of time to write headers metric."` FirstResponseByte string `description:"Name of time to first resposne byte metrics."` BytesReceived string `description:"Name of bytes received metric."` BytesSent string `description:"Name of bytes sent metric."` BytesTotal string `description:"Name of bytes sent and received metric."` PutIdle string `description:"Name of idle connection return count metric."` BackendTag string `description:"Name of the tag containing the backend reference."` PathTag string `description:"Name of the tag containing the path reference."` Backend string `description:"Static value for the backend tag metric."` Path string `description:"Static value for the path tag metric. If not specified, will be generated for each request."` OmitPathTag bool `` /* 147-byte string literal not displayed */ }
MetricsConfig contains settings for request metrics emissions.