Documentation ¶
Index ¶
- func DataChecksum(data []interface{}) (uint32, error)
- func GetTraceCode(skip int) (string, int, error)
- type Config
- type EventType
- type IDGenerator
- type Job
- type Tracer
- func (t *Tracer) AddJob(job *Job)
- func (t *Tracer) CollectSyncerBinlogEvent(source string, safeMode, tryReSync bool, globalPos, currentPos mysql.Position, ...) (*pb.SyncerBinlogEvent, error)
- func (t *Tracer) CollectSyncerJobEvent(traceID string, traceGID string, opType int32, pos, currentPos mysql.Position, ...) (*pb.SyncerJobEvent, error)
- func (t *Tracer) Enable() bool
- func (t *Tracer) FinishedSyncerJobState(err error) pb.SyncerJobState
- func (t *Tracer) GetTSO() int64
- func (t *Tracer) GetTraceID(source string) string
- func (t *Tracer) ProcessTraceEvents(jobs []*Job) error
- func (t *Tracer) Start()
- func (t *Tracer) Stop()
- type TracerHub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataChecksum ¶
DataChecksum calculates the checksum of a given interface{} slice. each interface{} is first converted to []byte via gob encoder, then combines all of them in sequence, at last calculate the crc32 using IEEE polynomial.
Types ¶
type Config ¶
type Config struct { Enable bool `toml:"enable" json:"enable"` // whether to enable tracing Source string `toml:"source" json:"source"` // trace event source id TracerAddr string `toml:"tracer-addr" json:"tracer-addr"` // tracing service rpc address BatchSize int `toml:"batch-size" json:"batch-size"` // upload trace event batch size Checksum bool `toml:"checksum" json:"checksum"` // whether to caclculate checksum of data }
Config is the configuration for tracer
type EventType ¶
type EventType byte
EventType represents trace event type
type IDGenerator ¶
IDGenerator is a simple ID generator
type Job ¶
type Job struct { Tp EventType Event interface{} }
Job is used for tracing evnets collecting and batch uploading
type Tracer ¶
Tracer is a tracing service provider
func GetTracer ¶
func GetTracer() *Tracer
GetTracer returns the tracer instance. If InitTracerHub is not called, returns a default disabled tracer.
func InitTracerHub ¶
InitTracerHub inits the singleton instance of TracerHub
func (*Tracer) CollectSyncerBinlogEvent ¶
func (t *Tracer) CollectSyncerBinlogEvent(source string, safeMode, tryReSync bool, globalPos, currentPos mysql.Position, eventType, opType int32) (*pb.SyncerBinlogEvent, error)
CollectSyncerBinlogEvent collects syncer binlog event and returns the trace event traceID
func (*Tracer) CollectSyncerJobEvent ¶
func (t *Tracer) CollectSyncerJobEvent(traceID string, traceGID string, opType int32, pos, currentPos mysql.Position, queueBucket, sql string, ddls []string, args []interface{}, req *pb.ExecDDLRequest, state pb.SyncerJobState) (*pb.SyncerJobEvent, error)
CollectSyncerJobEvent collects syncer job event and returns traceID
func (*Tracer) FinishedSyncerJobState ¶
func (t *Tracer) FinishedSyncerJobState(err error) pb.SyncerJobState
FinishedSyncerJobState returns pb.SyncerJobState according to given error
func (*Tracer) GetTraceID ¶
GetTraceID returns a new traceID for tracing
func (*Tracer) ProcessTraceEvents ¶
ProcessTraceEvents upload trace events to tracing service. ensure all jobs have same EventType