recording

package
Version: v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidID = errors.New("xid: invalid ID")

ErrInvalidID is returned when trying to unmarshal an invalid ID

View Source
var Recorders = []Recorder{}
View Source
var ShouldRecordAction = func(action Action) bool {
	return true
}
View Source
var TraceHeaderKeySpanId = TraceHeaderKey("si")
View Source
var TraceHeaderKeyTraceId = TraceHeaderKey("ti")

Functions

func EncodeAnyByteArray

func EncodeAnyByteArray(s []byte) json.RawMessage

Types

type Action

type Action interface {
	GetActionIndex() int
	GetOccurredAt() int64
	GetActionType() string
}

type AppendFile

type AppendFile struct {
	FileName string
	Content  []byte
	// contains filtered or unexported fields
}

func (*AppendFile) GetActionIndex

func (action *AppendFile) GetActionIndex() int

func (*AppendFile) GetActionType

func (action *AppendFile) GetActionType() string

func (*AppendFile) GetOccurredAt

func (action *AppendFile) GetOccurredAt() int64

func (*AppendFile) MarshalJSON

func (appendFile *AppendFile) MarshalJSON() ([]byte, error)

type AsyncRecorder

type AsyncRecorder struct {
	Context context.Context
	// contains filtered or unexported fields
}

func NewAsyncRecorder

func NewAsyncRecorder(realRecorder Recorder) *AsyncRecorder

func (*AsyncRecorder) Record

func (recorder *AsyncRecorder) Record(session *Session)

func (*AsyncRecorder) Start

func (recorder *AsyncRecorder) Start()

type CallFromInbound

type CallFromInbound struct {
	Peer     net.TCPAddr
	Request  []byte
	UnixAddr net.UnixAddr
	// contains filtered or unexported fields
}

func (*CallFromInbound) GetActionIndex

func (action *CallFromInbound) GetActionIndex() int

func (*CallFromInbound) GetActionType

func (action *CallFromInbound) GetActionType() string

func (*CallFromInbound) GetOccurredAt

func (action *CallFromInbound) GetOccurredAt() int64

func (*CallFromInbound) MarshalJSON

func (callFromInbound *CallFromInbound) MarshalJSON() ([]byte, error)

type CallOutbound

type CallOutbound struct {
	SocketFD     int
	Peer         net.TCPAddr
	Local        *net.TCPAddr `json:"-"`
	Request      []byte
	ResponseTime int64
	Response     []byte
	UnixAddr     net.UnixAddr
	CSpanId      []byte
	// contains filtered or unexported fields
}

func (*CallOutbound) GetActionIndex

func (action *CallOutbound) GetActionIndex() int

func (*CallOutbound) GetActionType

func (action *CallOutbound) GetActionType() string

func (*CallOutbound) GetIdentifier added in v0.0.5

func (callOutbound *CallOutbound) GetIdentifier() string

func (*CallOutbound) GetOccurredAt

func (action *CallOutbound) GetOccurredAt() int64

func (*CallOutbound) MarshalJSON

func (callOutbound *CallOutbound) MarshalJSON() ([]byte, error)

type ID

type ID [rawLen]byte

ID represents a unique request id

func FromString

func FromString(id string) (ID, error)

FromString reads an ID from its string representation

func (ID) Counter

func (id ID) Counter() int32

Counter returns the incrementing value part of the id. It's a runtime error to call this method with an invalid id.

func (ID) Machine

func (id ID) Machine() []byte

Machine returns the 3-byte machine id part of the id. It's a runtime error to call this method with an invalid id.

func (ID) MarshalText

func (id ID) MarshalText() ([]byte, error)

MarshalText implements encoding/text TextMarshaler interface

func (ID) Pid

func (id ID) Pid() uint16

Pid returns the process id part of the id. It's a runtime error to call this method with an invalid id.

func (*ID) Scan

func (id *ID) Scan(value interface{}) (err error)

Scan implements the sql.Scanner interface.

func (ID) String

func (id ID) String() string

String returns a base32 hex lowercased with no padding representation of the id (char set is 0-9, a-v).

func (ID) Time

func (id ID) Time() time.Time

Time returns the timestamp part of the id. It's a runtime error to call this method with an invalid id.

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(text []byte) error

UnmarshalText implements encoding/text TextUnmarshaler interface

func (ID) Value

func (id ID) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type ReadStorage

type ReadStorage struct {
	Content []byte
	// contains filtered or unexported fields
}

func (*ReadStorage) GetActionIndex

func (action *ReadStorage) GetActionIndex() int

func (*ReadStorage) GetActionType

func (action *ReadStorage) GetActionType() string

func (*ReadStorage) GetOccurredAt

func (action *ReadStorage) GetOccurredAt() int64

func (*ReadStorage) MarshalJSON

func (readStorage *ReadStorage) MarshalJSON() ([]byte, error)

type Recorder

type Recorder interface {
	Record(session *Session)
}

type ReturnInbound

type ReturnInbound struct {
	Response []byte
	// contains filtered or unexported fields
}

func (*ReturnInbound) GetActionIndex

func (action *ReturnInbound) GetActionIndex() int

func (*ReturnInbound) GetActionType

func (action *ReturnInbound) GetActionType() string

func (*ReturnInbound) GetOccurredAt

func (action *ReturnInbound) GetOccurredAt() int64

func (*ReturnInbound) MarshalJSON

func (returnInbound *ReturnInbound) MarshalJSON() ([]byte, error)

type SendUDP

type SendUDP struct {
	Peer    net.UDPAddr
	Content []byte
	// contains filtered or unexported fields
}

func (*SendUDP) GetActionIndex

func (action *SendUDP) GetActionIndex() int

func (*SendUDP) GetActionType

func (action *SendUDP) GetActionType() string

func (*SendUDP) GetOccurredAt

func (action *SendUDP) GetOccurredAt() int64

func (*SendUDP) MarshalJSON

func (sendUDP *SendUDP) MarshalJSON() ([]byte, error)

type Session

type Session struct {
	Context         string
	ThreadId        int32
	SessionId       string
	TraceHeader     TraceHeader
	TraceId         []byte
	SpanId          []byte
	NextSessionId   string
	CallFromInbound *CallFromInbound
	ReturnInbound   *ReturnInbound
	Actions         []Action
	// contains filtered or unexported fields
}

func NewSession

func NewSession(threadId int32) *Session

func (*Session) AppendFile

func (session *Session) AppendFile(ctx context.Context, content []byte, fileName string)

func (*Session) BeforeSendToOutbound

func (session *Session) BeforeSendToOutbound(ctx context.Context, peer net.TCPAddr, local *net.TCPAddr, socketFD int)

func (*Session) GetTraceHeader

func (session *Session) GetTraceHeader() TraceHeader

func (*Session) HasResponded

func (session *Session) HasResponded() bool

func (*Session) MarshalJSON

func (session *Session) MarshalJSON() ([]byte, error)

func (*Session) ReadStorage

func (session *Session) ReadStorage(ctx context.Context, span []byte)

func (*Session) RecvFromInbound

func (session *Session) RecvFromInbound(ctx context.Context, span []byte, peer net.TCPAddr, unix net.UnixAddr)

func (*Session) RecvFromOutbound

func (session *Session) RecvFromOutbound(ctx context.Context, span []byte, peer net.TCPAddr, local *net.TCPAddr, socketFD int)

func (*Session) SendToInbound

func (session *Session) SendToInbound(ctx context.Context, span []byte, peer net.TCPAddr)

func (*Session) SendToOutbound

func (session *Session) SendToOutbound(ctx context.Context, span []byte, peer net.TCPAddr, local *net.TCPAddr, socketFD int)

func (*Session) SendUDP

func (session *Session) SendUDP(ctx context.Context, span []byte, peer net.UDPAddr)

func (*Session) Shutdown

func (session *Session) Shutdown(ctx context.Context, newSession *Session)

func (*Session) Summary

func (session *Session) Summary(newSession *Session)

type Talk

type Talk struct {
	Peer         net.TCPAddr
	Request      []byte
	ResponseTime int64
	Response     []byte
}

type TraceHeader

type TraceHeader []byte

func (TraceHeader) Get

func (header TraceHeader) Get(targetKey TraceHeaderKey) TraceHeaderValue

func (TraceHeader) MarshalJSON

func (header TraceHeader) MarshalJSON() ([]byte, error)

func (TraceHeader) Next

func (TraceHeader) Set

func (header TraceHeader) Set(key TraceHeaderKey, value TraceHeaderValue) TraceHeader

type TraceHeaderKey

type TraceHeaderKey []byte

type TraceHeaderValue

type TraceHeaderValue []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL