syncedtrace

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ThtStrings = [...]string{
	"GetConn",
	"DNSStart",
	"DNSDone",
	"ConnectStart",
	"ConnectDone",
	"TLSHandshakeStart",
	"TLSHandshakeDone",
	"GotConn",
	"WroteHeaders",
	"WroteRequest",
	"Got100Continue",
	"GotFirstResponseByte",
	"Wait100Continue",
}

Functions

func GetTraceHooks

func GetTraceHooks(t *Trace) *httptrace.ClientTrace

Types

type Hook

type Hook struct {
	Time       time.Time     `json:"time"`
	Duration   time.Duration `json:"duration"`
	Wait       bool          `json:"did_wait"`
	LocalDrift time.Duration `json:"local_drift"`
	Err        error         `json:"error"`
}

func (*Hook) LogError

func (th *Hook) LogError(err error)

func (*Hook) LogTime

func (th *Hook) LogTime(now time.Time, latest time.Time)

func (*Hook) NeedToWait

func (th *Hook) NeedToWait() bool

func (*Hook) SetLocalDrift

func (th *Hook) SetLocalDrift(localDrift time.Duration)

func (*Hook) SetWait

func (th *Hook) SetWait()

func (*Hook) UnsetWait

func (th *Hook) UnsetWait()

type SyncConfig

type SyncConfig struct {
	Cond       *sync.Cond      `json:"-" yaml:"-"`
	ReadyWg    *sync.WaitGroup `json:"-" yaml:"-"`
	WaitOnHook TraceHookType   `json:"-" yaml:"-"`
}

type Trace

type Trace struct {
	*SyncConfig `json:"-" yaml:"-"`
	Id          uint64                  `json:"id" yaml:"id"`
	UniqueId    string                  `json:"unique_id" yaml:"unique_id"`
	TotalDrift  time.Duration           `json:"total_drift" yaml:"total_drift"`
	Start       time.Time               `json:"start_time" yaml:"start_time"`
	Latest      time.Time               `json:"latest" yaml:"latest"`
	Done        time.Time               `json:"done" yaml:"done"`
	Total       time.Duration           `json:"total" yaml:"total"`
	Error       bool                    `json:"had_error" yaml:"had_error"`
	LocalAddr   string                  `json:"local_addr" yaml:"local_addr"`
	Hooks       map[TraceHookType]*Hook `json:"hooks" yaml:"hooks"`
}

func New

func New(id uint64, syncConfig *SyncConfig) *Trace

func (*Trace) GetDrift

func (t *Trace) GetDrift() time.Duration

func (*Trace) IncreaseDrift

func (t *Trace) IncreaseDrift(start time.Time)

func (*Trace) LogError

func (t *Trace) LogError(hook TraceHookType, err error)

func (*Trace) LogTime

func (t *Trace) LogTime(hook TraceHookType)

func (*Trace) SetDone

func (t *Trace) SetDone()

func (*Trace) SetStart

func (t *Trace) SetStart(now time.Time)

func (*Trace) UpdateLatest

func (t *Trace) UpdateLatest(latest time.Time)

func (*Trace) WaitForSignal

func (t *Trace) WaitForSignal(hook TraceHookType)

type TraceHookType

type TraceHookType int
const (
	GetConn TraceHookType = iota
	DNSStart
	DNSDone
	ConnectStart
	ConnectDone
	TLSHandshakeStart
	TLSHandshakeDone
	GotConn
	WroteHeaders
	WroteRequest
	Got100Continue
	GotFirstResponseByte
	Wait100Continue
	HooksCount
)

func Unstring

func Unstring(name string) (TraceHookType, error)

func (TraceHookType) MarshalText

func (tht TraceHookType) MarshalText() (text []byte, err error)

func (TraceHookType) String

func (tht TraceHookType) String() string

func (*TraceHookType) UnmarshalText

func (tht *TraceHookType) UnmarshalText(text []byte) (err error)

Jump to

Keyboard shortcuts

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