Documentation ¶
Index ¶
- func DialNameFromContext(ctx context.Context) string
- func DialNameToContext(ctx context.Context, dialerName string) context.Context
- func DialWithDialContextFunc(parentDialerFunc dialerContextFunc) dialerOpt
- func DialWithDialer(parentDialer *net.Dialer) dialerOpt
- func DialWithName(name string) dialerOpt
- func DialWithTracing() dialerOpt
- func DialWithoutMonitoring() dialerOpt
- func NewDialContextFunc(optFuncs ...dialerOpt) func(context.Context, string, string) (net.Conn, error)
- func NewDialFunc(optFuncs ...dialerOpt) func(string, string) (net.Conn, error)
- func NewListener(inner net.Listener, optFuncs ...listenerOpt) net.Listener
- func PreRegisterDialerMetrics(dialerName string)
- func TrackWithName(name string) listenerOpt
- func TrackWithRetries(b backoff.Backoff) listenerOpt
- func TrackWithTcpKeepAlive(keepalive time.Duration) listenerOpt
- func TrackWithTracing() listenerOpt
- func TrackWithoutMonitoring() listenerOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialNameFromContext ¶
DialNameFromContext returns the name of the dialer from the context of the DialContext func, if any.
func DialNameToContext ¶
DialNameToContext returns a context that will contain a dialer name override.
func DialWithDialContextFunc ¶
func DialWithDialContextFunc(parentDialerFunc dialerContextFunc) dialerOpt
DialWithDialContextFunc allows you to override func gets used for the actual dialing. The default is `net.Dialer.DialContext`.
func DialWithDialer ¶
DialWithDialer allows you to override the `net.Dialer` instance used to actually conduct the dials.
func DialWithName ¶
func DialWithName(name string) dialerOpt
DialWithName sets the name of the dialer for tracking and monitoring. This is the name for the dialer (default is `default`), but for `NewDialContextFunc` can be overwritten from the Context using `DialNameToContext`.
func DialWithTracing ¶
func DialWithTracing() dialerOpt
DialWithTracing turns *on* the /debug/events tracing of the dial calls.
func DialWithoutMonitoring ¶
func DialWithoutMonitoring() dialerOpt
DialWithoutMonitoring turns *off* Prometheus monitoring for this dialer.
func NewDialContextFunc ¶
func NewDialContextFunc(optFuncs ...dialerOpt) func(context.Context, string, string) (net.Conn, error)
NewDialContextFunc returns a `DialContext` function that tracks outbound connections. The signature is compatible with `http.Tranport.DialContext` and is meant to be used there.
func NewDialFunc ¶
NewDialFunc returns a `Dial` function that tracks outbound connections. The signature is compatible with `http.Tranport.Dial` and is meant to be used there for Go < 1.7.
func NewListener ¶
NewListener returns the given listener wrapped in connection tracking listener.
func PreRegisterDialerMetrics ¶
func PreRegisterDialerMetrics(dialerName string)
preRegisterDialerMetrics pre-populates Prometheus labels for the given dialer name, to avoid Prometheus missing labels issue.
func TrackWithName ¶
func TrackWithName(name string) listenerOpt
TrackWithName sets the name of the Listener for use in tracking and monitoring.
func TrackWithRetries ¶
TrackWithRetries enables retrying of temporary Accept() errors, with the given backoff between attempts. Concurrent accept calls that receive temporary errors have independent backoff scaling.
func TrackWithTcpKeepAlive ¶
TrackWithTcpKeepAlive makes sure that any `net.TCPConn` that get accepted have a keep-alive. This is useful for HTTP servers in order for, for example laptops, to not use up resources on the server while they don't utilise their connection. A value of 0 disables it.
func TrackWithTracing ¶
func TrackWithTracing() listenerOpt
TrackWithTracing turns *on* the /debug/events tracing of the live listener connections.
func TrackWithoutMonitoring ¶
func TrackWithoutMonitoring() listenerOpt
TrackWithoutMonitoring turns *off* Prometheus monitoring for this listener.
Types ¶
This section is empty.