trace

package
v3.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 4 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearContext

func ClearContext(x interface{}) interface{}

func DriverOnClusterGet

func DriverOnClusterGet(t Driver, c context.Context) func(endpoint endpointInfo, _ error)

func DriverOnClusterInsert

func DriverOnClusterInsert(t Driver, c context.Context, endpoint endpointInfo) func(state ConnState)

func DriverOnClusterRemove

func DriverOnClusterRemove(t Driver, c context.Context, endpoint endpointInfo) func(state ConnState)

func DriverOnClusterUpdate

func DriverOnClusterUpdate(t Driver, c context.Context, endpoint endpointInfo) func(state ConnState)

func DriverOnConnInvoke

func DriverOnConnInvoke(t Driver, c context.Context, endpoint endpointInfo, m Method) func(_ error, issues []Issue, opID string, state ConnState)

func DriverOnConnNewStream

func DriverOnConnNewStream(t Driver, c context.Context, endpoint endpointInfo, m Method) func(error) func(state ConnState, _ error)

func DriverOnConnRelease

func DriverOnConnRelease(t Driver, c context.Context, endpoint endpointInfo) func(lock int)

func DriverOnConnStateChange

func DriverOnConnStateChange(t Driver, c context.Context, endpoint endpointInfo, state ConnState) func(state ConnState)

func DriverOnConnTake

func DriverOnConnTake(t Driver, c context.Context, endpoint endpointInfo) func(lock int, _ error)

func DriverOnDiscovery

func DriverOnDiscovery(t Driver, c context.Context) func(endpoints []string, _ error)

func DriverOnGetCredentials

func DriverOnGetCredentials(t Driver, c context.Context) func(tokenOk bool, _ error)

func DriverOnNetClose

func DriverOnNetClose(t Driver, address string) func(error)

func DriverOnNetDial

func DriverOnNetDial(t Driver, address string) func(error)

func DriverOnNetRead

func DriverOnNetRead(t Driver, address string, buffer int) func(received int, _ error)

func DriverOnNetWrite

func DriverOnNetWrite(t Driver, address string, bytes int) func(sent int, _ error)

func DriverOnPessimizeNode

func DriverOnPessimizeNode(t Driver, c context.Context, endpoint endpointInfo, state ConnState, cause error) func(state ConnState, _ error)

func RetryOnRetry

func RetryOnRetry(t Retry, c context.Context) func(_ context.Context, latency time.Duration, err error)

func Stub

func Stub(x interface{}, f func(name string, args ...interface{}))

Stub is a helper function that stubs all functional fields of x with given f.

func TableOnPoolClose

func TableOnPoolClose(t Table, c context.Context) func(error)

func TableOnPoolGet

func TableOnPoolGet(t Table, c context.Context) func(session sessionInfo, attempts int, _ error)

func TableOnPoolInit

func TableOnPoolInit(t Table, c context.Context) func(limit int, keepAliveMinSize int)

func TableOnPoolPut

func TableOnPoolPut(t Table, c context.Context, session sessionInfo) func(error)

func TableOnPoolRetry

func TableOnPoolRetry(t Table, c context.Context, idempotent bool) func(error) func(attempts int, _ error)

func TableOnPoolSessionClose

func TableOnPoolSessionClose(t Table, c context.Context, session sessionInfo) func()

func TableOnPoolSessionNew

func TableOnPoolSessionNew(t Table, c context.Context) func(session sessionInfo, _ error)

func TableOnPoolTake

func TableOnPoolTake(t Table, c context.Context, session sessionInfo) func() func(took bool, _ error)

func TableOnPoolWait

func TableOnPoolWait(t Table, c context.Context) func(session sessionInfo, _ error)

func TableOnSessionDelete

func TableOnSessionDelete(t Table, c context.Context, session sessionInfo) func(error)

func TableOnSessionKeepAlive

func TableOnSessionKeepAlive(t Table, c context.Context, session sessionInfo) func(error)

func TableOnSessionNew

func TableOnSessionNew(t Table, c context.Context) func(session sessionInfo, _ error)

func TableOnSessionQueryExecute

func TableOnSessionQueryExecute(t Table, c context.Context, session sessionInfo, query dataQuery, parameters queryParameters) func(tx transactionInfo, prepared bool, result result, _ error)

func TableOnSessionQueryPrepare

func TableOnSessionQueryPrepare(t Table, c context.Context, session sessionInfo, query string) func(result dataQuery, _ error)

func TableOnSessionQueryStreamExecute

func TableOnSessionQueryStreamExecute(t Table, c context.Context, session sessionInfo, query dataQuery, parameters queryParameters) func(result streamResult, _ error)

func TableOnSessionQueryStreamRead

func TableOnSessionQueryStreamRead(t Table, c context.Context, session sessionInfo) func(result streamResult, _ error)

func TableOnSessionTransactionBegin

func TableOnSessionTransactionBegin(t Table, c context.Context, session sessionInfo) func(tx transactionInfo, _ error)

func TableOnSessionTransactionCommit

func TableOnSessionTransactionCommit(t Table, c context.Context, session sessionInfo, tx transactionInfo) func(error)

func TableOnSessionTransactionRollback

func TableOnSessionTransactionRollback(t Table, c context.Context, session sessionInfo, tx transactionInfo) func(error)

func WithDriver

func WithDriver(ctx context.Context, t Driver) context.Context

WithDriver returns deadline which has associated Driver with it.

func WithRetry

func WithRetry(ctx context.Context, t Retry) context.Context

WithRetry returns deadline which has associated Retry with it.

func WithTable

func WithTable(ctx context.Context, t Table) context.Context

WithTable returns deadline which has associated Trace with it.

Types

type ClusterGetDoneInfo

type ClusterGetDoneInfo struct {
	Endpoint endpointInfo
	Error    error
}

type ClusterGetStartInfo

type ClusterGetStartInfo struct {
	Context context.Context
}

type ClusterInsertDoneInfo

type ClusterInsertDoneInfo struct {
	State ConnState
}

type ClusterInsertStartInfo

type ClusterInsertStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
}

type ClusterRemoveDoneInfo

type ClusterRemoveDoneInfo struct {
	State ConnState
}

type ClusterRemoveStartInfo

type ClusterRemoveStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
}

type ClusterUpdateDoneInfo

type ClusterUpdateDoneInfo struct {
	State ConnState
}

type ClusterUpdateStartInfo

type ClusterUpdateStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
}

type ConnInvokeDoneInfo

type ConnInvokeDoneInfo struct {
	Error  error
	Issues []Issue
	OpID   string
	State  ConnState
}

type ConnInvokeStartInfo

type ConnInvokeStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
	Method   Method
}

type ConnNewStreamDoneInfo

type ConnNewStreamDoneInfo struct {
	State ConnState
	Error error
}

type ConnNewStreamRecvInfo

type ConnNewStreamRecvInfo struct {
	Error error
}

type ConnNewStreamStartInfo

type ConnNewStreamStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
	Method   Method
}

type ConnReleaseDoneInfo

type ConnReleaseDoneInfo struct {
	Lock int
}

type ConnReleaseStartInfo

type ConnReleaseStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
}

type ConnState

type ConnState interface {
	IsValid() bool
	String() string
	Code() int
}

type ConnStateChangeDoneInfo

type ConnStateChangeDoneInfo struct {
	State ConnState
}

type ConnStateChangeStartInfo

type ConnStateChangeStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
	State    ConnState
}

type ConnTakeDoneInfo

type ConnTakeDoneInfo struct {
	Lock  int
	Error error
}

type ConnTakeStartInfo

type ConnTakeStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
}

type Details added in v3.2.1

type Details uint64
const (
	DriverSystemEvents      Details = 1 << iota // 1
	DriverClusterEvents                         // 2
	DriverNetEvents                             // 4
	DriverCoreEvents                            // 8
	DriverCredentialsEvents                     // 16
	DriverDiscoveryEvents                       // 32

	TableSessionLifeCycleEvents     // 64
	TableSessionQueryInvokeEvents   // 128
	TableSessionQueryStreamEvents   // 256
	TableSessionTransactionEvents   // 512
	TablePoolLifeCycleEvents        // 1024
	TablePoolRetryEvents            // 2048
	TablePoolSessionLifeCycleEvents // 4096
	TablePoolAPIEvents              // 8192

	DriverConnEvents        = DriverNetEvents | DriverCoreEvents                                                                     // 12
	TableSessionQueryEvents = TableSessionQueryInvokeEvents | TableSessionQueryStreamEvents                                          // 384
	TableSessionEvents      = TableSessionLifeCycleEvents | TableSessionQueryEvents | TableSessionTransactionEvents                  // 960
	TablePoolEvents         = TablePoolLifeCycleEvents | TablePoolRetryEvents | TablePoolSessionLifeCycleEvents | TablePoolAPIEvents // 15360
	DetailsAll              = ^Details(0)                                                                                            // 18446744073709551615
)

type DiscoveryDoneInfo

type DiscoveryDoneInfo struct {
	Endpoints []string
	Error     error
}

type DiscoveryStartInfo

type DiscoveryStartInfo struct {
	Context context.Context
}

type Driver

type Driver struct {
	// Network events
	OnNetRead  func(NetReadStartInfo) func(NetReadDoneInfo)
	OnNetWrite func(NetWriteStartInfo) func(NetWriteDoneInfo)
	OnNetDial  func(NetDialStartInfo) func(NetDialDoneInfo)
	OnNetClose func(NetCloseStartInfo) func(NetCloseDoneInfo)

	// Conn events
	OnConnStateChange func(ConnStateChangeStartInfo) func(ConnStateChangeDoneInfo)
	OnConnInvoke      func(ConnInvokeStartInfo) func(ConnInvokeDoneInfo)
	OnConnNewStream   func(ConnNewStreamStartInfo) func(ConnNewStreamRecvInfo) func(ConnNewStreamDoneInfo)
	OnConnTake        func(ConnTakeStartInfo) func(ConnTakeDoneInfo)
	OnConnRelease     func(ConnReleaseStartInfo) func(ConnReleaseDoneInfo)

	// Cluster events
	OnClusterGet    func(ClusterGetStartInfo) func(ClusterGetDoneInfo)
	OnClusterInsert func(ClusterInsertStartInfo) func(ClusterInsertDoneInfo)
	OnClusterUpdate func(ClusterUpdateStartInfo) func(ClusterUpdateDoneInfo)
	OnClusterRemove func(ClusterRemoveStartInfo) func(ClusterRemoveDoneInfo)
	OnPessimizeNode func(PessimizeNodeStartInfo) func(PessimizeNodeDoneInfo)

	// Credentials events
	OnGetCredentials func(GetCredentialsStartInfo) func(GetCredentialsDoneInfo)

	// Discovery events
	OnDiscovery func(DiscoveryStartInfo) func(DiscoveryDoneInfo)
}

func ContextDriver

func ContextDriver(ctx context.Context) Driver

ContextDriver returns Driver associated with ctx. If there is no Driver associated with ctx then zero value of Driver is returned.

func (Driver) Compose

func (t Driver) Compose(x Driver) (ret Driver)

Compose returns a new Driver which has functional fields composed both from t and x.

type ExecuteDataQueryStartInfo

type ExecuteDataQueryStartInfo struct {
	Context    context.Context
	Session    sessionInfo
	Query      dataQuery
	Parameters queryParameters
}

type FieldStubber

type FieldStubber struct {
	// OnStub is an optional callback that is called when field getting
	// stubbed.
	OnStub func(name string)

	// OnCall is an optional callback that will be called for each stubbed
	// field getting called.
	OnCall func(name string, args ...interface{})
}

FieldStubber contains options of filling all struct functional fields.

func (FieldStubber) Stub

func (f FieldStubber) Stub(x reflect.Value)

Stub fills in given x struct.

type GetCredentialsDoneInfo

type GetCredentialsDoneInfo struct {
	TokenOk bool
	Error   error
}

type GetCredentialsStartInfo

type GetCredentialsStartInfo struct {
	Context context.Context
}

type Issue

type Issue interface {
	GetMessage() string
	GetIssueCode() uint32
	GetSeverity() uint32
}

Issue interface

type KeepAliveDoneInfo

type KeepAliveDoneInfo struct {
	Error error
}

type KeepAliveStartInfo

type KeepAliveStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type Method

type Method string

Method represents rpc method.

func (Method) Name

func (m Method) Name() (s string)

Name returns the rpc method name.

func (Method) Service

func (m Method) Service() (s string)

Service returns the rpc service name.

func (Method) Split

func (m Method) Split() (service, method string)

Split returns service name and method.

type NetCloseDoneInfo

type NetCloseDoneInfo struct {
	Error error
}

type NetCloseStartInfo

type NetCloseStartInfo struct {
	Address string
}

type NetDialDoneInfo

type NetDialDoneInfo struct {
	Error error
}

type NetDialStartInfo

type NetDialStartInfo struct {
	Address string
}

type NetReadDoneInfo

type NetReadDoneInfo struct {
	Received int
	Error    error
}

type NetReadStartInfo

type NetReadStartInfo struct {
	Address string
	Buffer  int
}

type NetWriteDoneInfo

type NetWriteDoneInfo struct {
	Sent  int
	Error error
}

type NetWriteStartInfo

type NetWriteStartInfo struct {
	Address string
	Bytes   int
}

type PessimizeNodeDoneInfo

type PessimizeNodeDoneInfo struct {
	State ConnState
	Error error
}

type PessimizeNodeStartInfo

type PessimizeNodeStartInfo struct {
	Context  context.Context
	Endpoint endpointInfo
	State    ConnState
	Cause    error
}

type PoolCloseDoneInfo

type PoolCloseDoneInfo struct {
	Error error
}

type PoolCloseStartInfo

type PoolCloseStartInfo struct {
	Context context.Context
}

type PoolGetDoneInfo

type PoolGetDoneInfo struct {
	Session  sessionInfo
	Attempts int
	Error    error
}

type PoolGetStartInfo

type PoolGetStartInfo struct {
	Context context.Context
}

type PoolInitDoneInfo

type PoolInitDoneInfo struct {
	Limit            int
	KeepAliveMinSize int
}

type PoolInitStartInfo

type PoolInitStartInfo struct {
	Context context.Context
}

type PoolPutDoneInfo

type PoolPutDoneInfo struct {
	Error error
}

type PoolPutStartInfo

type PoolPutStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type PoolRetryDoneInfo

type PoolRetryDoneInfo struct {
	Attempts int
	Error    error
}

type PoolRetryInternalInfo

type PoolRetryInternalInfo struct {
	Error error
}

type PoolRetryStartInfo

type PoolRetryStartInfo struct {
	Context    context.Context
	Idempotent bool
}

type PoolSessionCloseDoneInfo

type PoolSessionCloseDoneInfo struct {
}

type PoolSessionCloseStartInfo

type PoolSessionCloseStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type PoolSessionNewDoneInfo

type PoolSessionNewDoneInfo struct {
	Session sessionInfo
	Error   error
}

type PoolSessionNewStartInfo

type PoolSessionNewStartInfo struct {
	Context context.Context
}

type PoolTakeDoneInfo

type PoolTakeDoneInfo struct {
	Took  bool
	Error error
}

type PoolTakeStartInfo

type PoolTakeStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type PoolTakeWaitInfo

type PoolTakeWaitInfo struct {
}

type PoolWaitDoneInfo

type PoolWaitDoneInfo struct {
	Session sessionInfo
	Error   error
}

PoolWaitDoneInfo means a wait iteration inside Get call is done Warning: Session and Error may be nil at the same time. This means that a wait iteration donned without any significant result

type PoolWaitStartInfo

type PoolWaitStartInfo struct {
	Context context.Context
}

type PrepareDataQueryDoneInfo

type PrepareDataQueryDoneInfo struct {
	Result dataQuery
	Error  error
}

type Retry

type Retry struct {
	OnRetry func(RetryLoopStartInfo) func(RetryLoopDoneInfo)
}

func ContextRetry

func ContextRetry(ctx context.Context) Retry

ContextRetry returns Retry associated with ctx. If there is no Retry associated with ctx then zero value of Retry is returned.

func (Retry) Compose

func (t Retry) Compose(x Retry) (ret Retry)

Compose returns a new Retry which has functional fields composed both from t and x.

type RetryLoopDoneInfo

type RetryLoopDoneInfo struct {
	Context context.Context
	Latency time.Duration
	Err     error
}

type RetryLoopStartInfo

type RetryLoopStartInfo struct {
	Context context.Context
}

type SessionDeleteDoneInfo

type SessionDeleteDoneInfo struct {
	Error error
}

type SessionDeleteStartInfo

type SessionDeleteStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type SessionNewDoneInfo

type SessionNewDoneInfo struct {
	Session sessionInfo
	Error   error
}

type SessionNewStartInfo

type SessionNewStartInfo struct {
	Context context.Context
}

type SessionQueryPrepareDoneInfo

type SessionQueryPrepareDoneInfo struct {
	Tx       transactionInfo
	Prepared bool
	Result   result
	Error    error
}

type SessionQueryPrepareStartInfo

type SessionQueryPrepareStartInfo struct {
	Context context.Context
	Session sessionInfo
	Query   string
}

type SessionQueryStreamExecuteDoneInfo

type SessionQueryStreamExecuteDoneInfo struct {
	Result streamResult
	Error  error
}

type SessionQueryStreamExecuteStartInfo

type SessionQueryStreamExecuteStartInfo struct {
	Context    context.Context
	Session    sessionInfo
	Query      dataQuery
	Parameters queryParameters
}

type SessionQueryStreamReadDoneInfo

type SessionQueryStreamReadDoneInfo struct {
	Result streamResult
	Error  error
}

type SessionQueryStreamReadStartInfo

type SessionQueryStreamReadStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type SessionTransactionBeginDoneInfo

type SessionTransactionBeginDoneInfo struct {
	Tx    transactionInfo
	Error error
}

type SessionTransactionBeginStartInfo

type SessionTransactionBeginStartInfo struct {
	Context context.Context
	Session sessionInfo
}

type SessionTransactionCommitDoneInfo

type SessionTransactionCommitDoneInfo struct {
	Error error
}

type SessionTransactionCommitStartInfo

type SessionTransactionCommitStartInfo struct {
	Context context.Context
	Session sessionInfo
	Tx      transactionInfo
}

type SessionTransactionRollbackDoneInfo

type SessionTransactionRollbackDoneInfo struct {
	Error error
}

type SessionTransactionRollbackStartInfo

type SessionTransactionRollbackStartInfo struct {
	Context context.Context
	Session sessionInfo
	Tx      transactionInfo
}

type Table

type Table struct {
	// Session events
	OnSessionNew       func(SessionNewStartInfo) func(SessionNewDoneInfo)
	OnSessionDelete    func(SessionDeleteStartInfo) func(SessionDeleteDoneInfo)
	OnSessionKeepAlive func(KeepAliveStartInfo) func(KeepAliveDoneInfo)
	// Query events
	OnSessionQueryPrepare func(SessionQueryPrepareStartInfo) func(PrepareDataQueryDoneInfo)
	OnSessionQueryExecute func(ExecuteDataQueryStartInfo) func(SessionQueryPrepareDoneInfo)
	// Stream events
	OnSessionQueryStreamExecute func(SessionQueryStreamExecuteStartInfo) func(SessionQueryStreamExecuteDoneInfo)
	OnSessionQueryStreamRead    func(SessionQueryStreamReadStartInfo) func(SessionQueryStreamReadDoneInfo)
	// Transaction events
	OnSessionTransactionBegin    func(SessionTransactionBeginStartInfo) func(SessionTransactionBeginDoneInfo)
	OnSessionTransactionCommit   func(SessionTransactionCommitStartInfo) func(SessionTransactionCommitDoneInfo)
	OnSessionTransactionRollback func(SessionTransactionRollbackStartInfo) func(SessionTransactionRollbackDoneInfo)
	// Pool events
	OnPoolInit  func(PoolInitStartInfo) func(PoolInitDoneInfo)
	OnPoolClose func(PoolCloseStartInfo) func(PoolCloseDoneInfo)
	OnPoolRetry func(PoolRetryStartInfo) func(info PoolRetryInternalInfo) func(PoolRetryDoneInfo)
	// Pool session lifecycle events
	OnPoolSessionNew   func(PoolSessionNewStartInfo) func(PoolSessionNewDoneInfo)
	OnPoolSessionClose func(PoolSessionCloseStartInfo) func(PoolSessionCloseDoneInfo)
	// Pool common API events
	OnPoolPut func(PoolPutStartInfo) func(PoolPutDoneInfo)
	// Pool native API events
	OnPoolGet  func(PoolGetStartInfo) func(PoolGetDoneInfo)
	OnPoolWait func(PoolWaitStartInfo) func(PoolWaitDoneInfo)
	// Pool ydbsql API events
	OnPoolTake func(PoolTakeStartInfo) func(PoolTakeWaitInfo) func(PoolTakeDoneInfo)
}

Table contains options for tracing table client activity.

func ContextTable

func ContextTable(ctx context.Context) Table

ContextTable returns Table associated with ctx. If there is no Table associated with ctx then zero value of Trace is returned.

func (Table) Compose

func (t Table) Compose(x Table) (ret Table)

Compose returns a new Table which has functional fields composed both from t and x.

Jump to

Keyboard shortcuts

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