track

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxServedField = StreamSendFilter

Variables

This section is empty.

Functions

func BindRequestAndResponse

func BindRequestAndResponse(req context.Context, resp context.Context)

func DisableTrack

func DisableTrack()

func EnableTrack

func EnableTrack()

func TrackEnabled

func TrackEnabled() bool

Types

type TimestampPhase

type TimestampPhase int
const (
	RequestStartTimestamp TimestampPhase = iota
	ResponseStartTimestamp
	MaxTimestampPhase
)
const TrackStartTimestamp TimestampPhase = RequestStartTimestamp

TrackStartTimestamp is an alias for RequestStartTimestamp we think a mosn stream is begin when a request received

type TrackBuffer

type TrackBuffer struct {
	*Tracks
}

func TrackBufferByContext

func TrackBufferByContext(ctx context.Context) *TrackBuffer

type TrackPhase

type TrackPhase int
const (
	// reserved fields
	ProtocolDecode          TrackPhase = iota // request and response
	StreamFilterBeforeRoute                   //
	MatchRoute                                // maybe reroute, or multiple steps
	StreamFilterAfterRoute
	LoadBalanceChooseHost // maybe rechoose host
	StreamFilterAfterChooseHost
	NetworkDataWrite // request and response
	StreamSendFilter
	// some extends fields
	// max phase
	MaxTrackPhase TrackPhase = 15
)
const NoTrack TrackPhase = -1

type TrackTime

type TrackTime struct {
	P     time.Time
	Costs []time.Duration
}

type Tracks

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

func (*Tracks) Begin

func (t *Tracks) Begin()

func (*Tracks) EndTrack

func (t *Tracks) EndTrack(phase TrackPhase)

func (*Tracks) GetTrackCosts

func (t *Tracks) GetTrackCosts() string

GetTrackCosts is a wrapper for tracks.Range, only get strings to reserved fields if a extends fields added, use Range [][][]...[]

func (*Tracks) GetTrackTimestamp

func (t *Tracks) GetTrackTimestamp() string

GetTrackTimestamp is a wrapper for tracks.VisitTimestamp, get request and response timestamp

func (*Tracks) Range

func (t *Tracks) Range(f func(TrackPhase, TrackTime) bool)

Range ranges the tracks data by f. if f returns false, terminate the range

func (*Tracks) StartTrack

func (t *Tracks) StartTrack(phase TrackPhase)

func (*Tracks) VisitTimestamp

func (t *Tracks) VisitTimestamp(f func(TimestampPhase, time.Time) bool)

Jump to

Keyboard shortcuts

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