tr

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const ISO8601 = "2006-01-02T15:04:05.99999Z07:00"

------------------------------------------------------------------------------------------------------------------------------------------

Variables

View Source
var Ttl uint64 = default_ttl

Functions

func SVar

func SVar(v interface{}) string

------------------------------------------------------------------------------------------------------------------------------------------

func TopOfTheHour

func TopOfTheHour() (prev, cur string)

func TraceDbEndQry

func TraceDbEndQry(s string, v ...interface{}) time.Duration

func TraceDbStartQry

func TraceDbStartQry(s string)

func TraceFunc

func TraceFunc(name string, args ...interface{})

----------------------------------------------------------------------------------------------------------

func TraceFuncExit

func TraceFuncExit(name string)

----------------------------------------------------------------------------------------------------------

Types

type ANote

type ANote struct {
	Txt      string
	File     string
	Line     string
	FuncName string
}

this.Note = append ( this.Note, ANote{ Txt:note, File:file, Line:fmt.Sprintf("%d",line), FuncName:xfunc ) } )

type APathMatch

type APathMatch struct {
	AtDepth        int
	Match          string
	Url            string
	MiddlewareName string
	ErrorReturn    string
}

type AnItemType

type AnItemType int

----------------------------------------------------------------------------------------------------------

const (
	Fx   AnItemType = iota
	User            // Implemented at the D.B. & Fucntion level
	URI
	Table
	Db
	Redis
)

type AvgTime

type AvgTime struct {
	Avg float64
	N   int64
	Min float64
	Max float64
}

type DBQryHash

type DBQryHash struct {
	QryMap map[string]DBTiming
}
var TimeDbCall DBQryHash

----------------------------------------------------------------------------------------------------------

type DBTiming

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

----------------------------------------------------------------------------------------------------------

type FuncData

type FuncData struct {
	Type     string
	File     string
	Line     string
	FuncName string
}

type OnOffIgnore

type OnOffIgnore int

----------------------------------------------------------------------------------------------------------

const (
	On OnOffIgnore = iota
	Off
	Ignore
)

type QryData

type QryData struct {
	SQL      string
	BindData []interface{}
	Time     string
	RvData   string
	QError   string
	File     string
	Line     string
	FuncName string
}

{ "SQL": "select...", "Data": [ ... ], "Time": ..., "RvData": [ ... ], "FuncName":... }

type TraceConfig

type TraceConfig struct {
	TraceFuncs map[int]TraceItem
}

----------------------------------------------------------------------------------------------------------

type TraceItem

type TraceItem struct {
	ItemType AnItemType  // func, user, URI, table
	OnOff    OnOffIgnore // Is item T=included or F=excluded,  i=ignored
	Data1    string
	Data2    string
}

----------------------------------------------------------------------------------------------------------

type Trx

type Trx struct {
	Key                   int
	Data                  []common.NameValueFrom
	Func                  []FuncData
	From                  string
	Qry                   []QryData
	RvBody                string
	ClientIp              string
	RequestTime           string
	Method, Uri, Protocol string
	Status                int
	ResponseBytes         int64
	ElapsedTime           string // In Seconds
	ElapsedTimeMs         string // In Milesconds

	TableList     []string
	Note          []ANote
	Username      string
	User_id       string
	Auth_token    string
	HasBeenSaved  bool
	IAm           string
	MiddlewareStk []APathMatch

	RequestId string
	Header    http.Header
	// contains filtered or unexported fields
}

func NewTrx

func NewTrx(r *pool.Pool) *Trx

func (*Trx) AddData

func (this *Trx) AddData(i string, m url.Values, fr map[string]string)

func (*Trx) AddNote

func (this *Trx) AddNote(depth int, note string)

func (*Trx) At

func (this *Trx) At(depth int)

trx.At ( file, lineno ) -- opt-save --

func (*Trx) ErrorReturn

func (this *Trx) ErrorReturn(depth int, err error)

func (*Trx) GetKeySeqNo

func (this *Trx) GetKeySeqNo() (int64, int)

func (*Trx) IncrSeqNo

func (this *Trx) IncrSeqNo() int

func (*Trx) MatchedPath

func (this *Trx) MatchedPath(depth int, note string)

func (*Trx) NextNoMatch

func (this *Trx) NextNoMatch(depth int, note string)

func (*Trx) PathMatched

func (this *Trx) PathMatched(depth int, middlewareName string, path []string, pn int, url string)

func (*Trx) SaveIt

func (this *Trx) SaveIt()

func (*Trx) SavePointOn

func (this *Trx) SavePointOn(x int) bool

func (*Trx) SetCacheData

func (this *Trx) SetCacheData(sql string, depth int, rvData string, data ...interface{})

func (*Trx) SetDataPs

func (this *Trx) SetDataPs(data []common.NameValueFrom)

func (*Trx) SetFrom

func (this *Trx) SetFrom(from string)

trx.From ( ... )

func (*Trx) SetFunc

func (this *Trx) SetFunc(depth int)

trx.Func ( name, file, lineno ) -- opt-save --

func (*Trx) SetFuncRet

func (this *Trx) SetFuncRet(depth int)

func (*Trx) SetHeader

func (this *Trx) SetHeader(h http.Header)

func (*Trx) SetQry

func (this *Trx) SetQry(sql string, depth int, data ...interface{})

trx.Qry ( Sql, Data, FuncName, FileName, LineNo ) -- opt-save --

func (*Trx) SetQryDone

func (this *Trx) SetQryDone(qError string, rvData string)

trx.QryDone ( RvData ) -- opt-save --

func (*Trx) SetRvBody

func (this *Trx) SetRvBody(rvBody string)

trx.RvBody ( ... )

func (*Trx) SetSavePoint

func (this *Trx) SetSavePoint(s string, on bool)

func (*Trx) SetTablesUsed

func (this *Trx) SetTablesUsed(tableList []string)

func (*Trx) SetTraceDebug

func (this *Trx) SetTraceDebug(db bool)

func (*Trx) SetUserInfo

func (this *Trx) SetUserInfo(username string, user_id string, auth_token string)

trx.From ( ... )

func (*Trx) StartSeqNo

func (this *Trx) StartSeqNo() int
func (this *Trx) IncrKeyNo() int64 {
	g_key_no = this.getRedisIncrKey("rest:trace:uri:key1")
	return g_key_no
}

func (*Trx) TraceDb

func (this *Trx) TraceDb(name string, qry string, args ...interface{})

----------------------------------------------------------------------------------------------------------

func (*Trx) TraceDb2

func (this *Trx) TraceDb2(name string, qry string, args ...interface{})

func (*Trx) TraceDbData

func (this *Trx) TraceDbData(name string, qry string, args ...interface{})

func (*Trx) TraceDbEnd

func (this *Trx) TraceDbEnd(name string, qry string, n_rows int)

func (*Trx) TraceDbError

func (this *Trx) TraceDbError(name string, qry string, err error)

func (*Trx) TraceDbError2

func (this *Trx) TraceDbError2(name string, qry string, err error)

func (*Trx) TraceDbRet

func (this *Trx) TraceDbRet(name string, args ...interface{})

func (*Trx) TraceDbRetJson

func (this *Trx) TraceDbRetJson(name string, data string)

func (*Trx) TraceGetConfig

func (this *Trx) TraceGetConfig() (uint64, bool)

func (*Trx) TraceInitConfig

func (this *Trx) TraceInitConfig(r *pool.Pool)

func (*Trx) TraceSetConfig

func (this *Trx) TraceSetConfig(p_ttl uint64, p_trace_on bool, p_stdout_on bool)

func (*Trx) TraceUri

func (this *Trx) TraceUri(req *http.Request, mm url.Values)

----------------------------------------------------------------------------------------------------------

func (*Trx) TraceUriPs

func (this *Trx) TraceUriPs(req *http.Request, ps string)

---------------------------------------------------------------------------------------------------------- ps is convered ps.DumpParams() from the Params package // ps *goftlmux.Params

func (*Trx) TraceUriRaw

func (this *Trx) TraceUriRaw(req *http.Request)

func (*Trx) TraceUriRawEnd

func (this *Trx) TraceUriRawEnd(req *http.Request, elapsedTime time.Duration)

func (*Trx) TraceUriRawEndHijacked

func (this *Trx) TraceUriRawEndHijacked(req *http.Request, elapsedTime time.Duration)

func (*Trx) TrxIdSeen

func (this *Trx) TrxIdSeen(TrxId, URL, Method string)

func (*Trx) UpdateDataPs

func (this *Trx) UpdateDataPs(data []common.NameValueFrom)

func (*Trx) UriSaveData

func (this *Trx) UriSaveData(clientIP string, runAtTime time.Time, method string, uri string, protocal string, status int, bodyLen int64, elapsedTime time.Duration, r *http.Request)

func (*Trx) UriStart

func (this *Trx) UriStart(uri string)

trx.UriStart ( ... ) -- opt-save --

Jump to

Keyboard shortcuts

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