nettrace

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Budget

type Budget struct {
	Total     time.Duration
	Tolerance time.Duration
	Phases    map[PhaseKind]time.Duration
}

func (Budget) Clone

func (b Budget) Clone() Budget

Clone produces a deep copy of the budget to prevent shared mutations.

type BudgetBreach

type BudgetBreach struct {
	Kind   PhaseKind
	Limit  time.Duration
	Actual time.Duration
	Over   time.Duration
}

type BudgetReport

type BudgetReport struct {
	Breaches []BudgetBreach
}

func EvaluateBudget

func EvaluateBudget(tl *Timeline, b Budget) BudgetReport

func (BudgetReport) WithinLimit

func (r BudgetReport) WithinLimit() bool

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

func NewCollector

func NewCollector() *Collector

func (*Collector) Begin

func (c *Collector) Begin(kind PhaseKind, ts time.Time)

func (*Collector) Complete

func (c *Collector) Complete(ts time.Time)

func (*Collector) End

func (c *Collector) End(kind PhaseKind, ts time.Time, err error)

func (*Collector) Fail

func (c *Collector) Fail(err error)

func (*Collector) Timeline

func (c *Collector) Timeline() *Timeline

func (*Collector) UpdateMeta

func (c *Collector) UpdateMeta(kind PhaseKind, fn func(*PhaseMeta))

type ConnDetails added in v0.15.0

type ConnDetails struct {
	Reused        bool
	WasIdle       bool
	IdleTime      time.Duration
	Network       string
	DialAddr      string
	LocalAddr     string
	RemoteAddr    string
	ResolvedAddrs []string
	Proxy         string
	ProxyTunnel   bool
	SSH           string
	K8s           string
	Protocol      string
}

func (*ConnDetails) Clone added in v0.15.0

func (c *ConnDetails) Clone() *ConnDetails

type Phase

type Phase struct {
	Kind     PhaseKind
	Start    time.Time
	End      time.Time
	Duration time.Duration
	Err      string
	Meta     PhaseMeta
}

type PhaseKind

type PhaseKind string
const (
	PhaseDNS      PhaseKind = "dns"
	PhaseConnect  PhaseKind = "connect"
	PhaseTLS      PhaseKind = "tls"
	PhaseReqHdrs  PhaseKind = "request_headers"
	PhaseReqBody  PhaseKind = "request_body"
	PhaseTTFB     PhaseKind = "ttfb"
	PhaseTransfer PhaseKind = "transfer"
	PhaseTotal    PhaseKind = "total"
)

type PhaseMeta

type PhaseMeta struct {
	Addr   string
	Reused bool
	Cached bool
}

type Report

type Report struct {
	Timeline     *Timeline
	Budget       Budget
	BudgetReport BudgetReport
}

Report summarises a collected timeline along with evaluated budgets.

func NewReport

func NewReport(tl *Timeline, budget Budget) *Report

NewReport builds a trace report for the provided timeline and budget. The timeline is cloned to keep the report immutable.

func (*Report) Clone

func (r *Report) Clone() *Report

Clone returns a deep copy of the report so callers can safely mutate it.

type TLSCert added in v0.15.0

type TLSCert struct {
	Subject   string
	Issuer    string
	SANs      []string
	NotBefore time.Time
	NotAfter  time.Time
	Serial    string
}

func (TLSCert) Clone added in v0.15.0

func (c TLSCert) Clone() TLSCert

type TLSDetails added in v0.15.0

type TLSDetails struct {
	Version      string
	Cipher       string
	ALPN         string
	ServerName   string
	Resumed      bool
	Verified     bool
	Certificates []TLSCert
}

func (*TLSDetails) Clone added in v0.15.0

func (t *TLSDetails) Clone() *TLSDetails

type Timeline

type Timeline struct {
	Started   time.Time
	Completed time.Time
	Duration  time.Duration
	Err       string
	Phases    []Phase
	Details   *TraceDetails
}

func (*Timeline) Clone

func (tl *Timeline) Clone() *Timeline

type TraceDetails added in v0.15.0

type TraceDetails struct {
	Connection *ConnDetails
	TLS        *TLSDetails
}

func (*TraceDetails) Clone added in v0.15.0

func (d *TraceDetails) Clone() *TraceDetails

Jump to

Keyboard shortcuts

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