trace

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 36

Documentation

Overview

github.com/whatap/go-api/trace

github.com/whatap/go-api/trace

Index

Constants

View Source
const (
	STAT_METHOD = 0
	STAT_SQL    = 1
	STAT_HTTPC  = 2
	STAT_DBC    = 3
	STAT_SOCKET = 4
)

Variables

View Source
var (
	WHATAP_COOKIE_NAME = "WHATAP"
)

Functions

func AddTraceCtx

func AddTraceCtx(traceCtx *TraceCtx)

func CloseTraceContext

func CloseTraceContext(ctx *TraceCtx)

func End

func End(ctx context.Context, err error) error

func Error

func Error(ctx context.Context, err error) error

func Func

func Func(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)

wrapping handler function, example : http.HandleFunc(func(http.ResponseWriter, *http.Request))

func GetActiveStats

func GetActiveStats() []int16

func GetClientId

func GetClientId(r *http.Request) string

func GetMTrace

func GetMTrace(ctx context.Context) http.Header

func GetTxid

func GetTxid(ctx context.Context) int64

func GetWhatapCookie

func GetWhatapCookie(r *http.Request) (*http.Cookie, bool)

func HandlerFunc

func HandlerFunc(handler func(http.ResponseWriter, *http.Request)) http.HandlerFunc

wrapping type of http.HanderFunc, example : http.Handle(pattern, http.HandlerFunc)

func Init

func Init(m map[string]string)

func RemoveTraceCtx

func RemoveTraceCtx(traceCtx *TraceCtx)

func SetHeader

func SetHeader(ctx context.Context, m map[string][]string)

func SetParameter

func SetParameter(ctx context.Context, m map[string][]string)

func Shutdown

func Shutdown()

func Start

func Start(ctx context.Context, name string) (context.Context, error)

func StartWithContext

func StartWithContext(ctx context.Context, name string) (context.Context, error)

func StartWithRequest

func StartWithRequest(r *http.Request) (context.Context, error)

func Step

func Step(ctx context.Context, title, message string, elapsed, value int) error

func UpdateMtrace

func UpdateMtrace(traceCtx *TraceCtx, header http.Header)

func UpdateMtraceWithContext

func UpdateMtraceWithContext(ctx context.Context, header http.Header)

Types

type TaskActiveStats

type TaskActiveStats struct {
}

func (*TaskActiveStats) Process

func (this *TaskActiveStats) Process(now int64)

type TraceCtx

type TraceCtx struct {
	Txid      int64
	Name      string
	StartTime int64

	// Pack
	Host             string
	Uri              string
	Ipaddr           string
	UAgent           string
	Ref              string
	WClientId        string
	HttpMethod       string
	IsStaticContents string

	MTid        int64
	MDepth      int32
	MCallerTxid int64

	MCallee     int64
	MCallerSpec string
	MCallerUrl  string

	MCallerPoidKey string

	TraceMtraceCallerValue string
	TraceMtracePoidValue   string
	TraceMtraceSpecValue   string

	ActiveSQL    bool
	ActiveHTTPC  bool
	ActiveDBC    bool
	ActiveSocket bool
}

func GetTraceContext

func GetTraceContext(ctx context.Context) (context.Context, *TraceCtx)

func NewTraceContext

func NewTraceContext(ctx context.Context) (context.Context, *TraceCtx)

func NewTraceCtx

func NewTraceCtx() *TraceCtx

func PoolTraceContext

func PoolTraceContext() *TraceCtx

func (*TraceCtx) Clear

func (this *TraceCtx) Clear()

func (*TraceCtx) GetElapsedTime

func (this *TraceCtx) GetElapsedTime() int

Jump to

Keyboard shortcuts

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