connstats

package
v1.28.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package connstats counts the sockets and requests of the transports built by util.MakeTransport, so registry connection reuse is visible without a proxy in front of the registry. A proxy cannot see through TLS to a real registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Trace

Trace records whether a request reused its connection, how long that connection sat idle first, and what the TLS handshake cost.

Types

type DialFunc

type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)

DialFunc matches http.Transport.DialContext.

func WrapDial

func WrapDial(dial DialFunc) DialFunc

WrapDial counts every socket the transport opens and closes. net/http reports neither to its caller, and httptrace has no close hook.

type Stats

type Stats struct {
	SocketsOpened int64
	SocketsClosed int64
	SocketsOpen   int64
	PeakSockets   int64
	Requests      int64
	Reused        int64
	TLSHandshakes int64
	DialTime      time.Duration
	TLSTime       time.Duration
	IdleTime      time.Duration
}

Stats totals the registry traffic so far.

func Snapshot

func Snapshot() Stats

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL