Documentation ¶
Index ¶
- func GetTraceID(ctx context.Context) string
- func GetTraceURL(ctx context.Context) (u string)
- func InitOpenTracing(serviceName string, opts ...OptionFunc) error
- func IsTracerActive() bool
- func Log(ctx context.Context, key string, value interface{})
- func LogEvent(ctx context.Context, event string, payload ...interface{})
- func LogStackTrace(trace Tracer)
- func SetError(ctx context.Context, err error)
- func SetTracerPlatformType(t PlatformType)
- func SkipTraceContext(ctx context.Context) context.Context
- func WithTracerFunc(ctx context.Context, operationName string, fn func(context.Context, Tracer))
- type FinishOption
- type FinishOptionFunc
- func FinishWithAdditionalTags(tags map[string]interface{}) FinishOptionFunc
- func FinishWithError(err error) FinishOptionFunc
- func FinishWithFunc(finishFunc func()) FinishOptionFunc
- func FinishWithRecoverPanic(recoverFunc func(panicMessage any)) FinishOptionFunc
- func FinishWithStackTraceDetail() FinishOptionFunc
- type Option
- type OptionFunc
- func OptionSetAgentHost(agent string) OptionFunc
- func OptionSetBuildNumberTag(number string) OptionFunc
- func OptionSetErrorWhitelist(errs []error) OptionFunc
- func OptionSetLevel(level string) OptionFunc
- func OptionSetLogAllSpan() OptionFunc
- func OptionSetMaxGoroutineTag(max int) OptionFunc
- func OptionSetTraceDashboardURL(dashboardURL string) OptionFunc
- func OptionSetTraceIDExtractor(extractor func(context.Context) string) OptionFunc
- type PlatformType
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitOpenTracing ¶
func InitOpenTracing(serviceName string, opts ...OptionFunc) error
DEPRECATED: use InitJaeger
func IsTracerActive ¶ added in v1.17.0
func IsTracerActive() bool
IsTracerActive check tracer has been initialized with platform
func LogStackTrace ¶ added in v1.15.0
func LogStackTrace(trace Tracer)
LogStackTrace log stack trace in recover panic
func SetTracerPlatformType ¶ added in v1.9.3
func SetTracerPlatformType(t PlatformType)
SetTracerPlatformType function for set tracer platform
func SkipTraceContext ¶
SkipTraceContext inject to context for skip span tracer
Types ¶
type FinishOption ¶ added in v1.10.6
type FinishOption struct {
// contains filtered or unexported fields
}
FinishOption for option when trace is finished
type FinishOptionFunc ¶ added in v1.10.6
type FinishOptionFunc func(*FinishOption)
FinishOptionFunc func
func FinishWithAdditionalTags ¶ added in v1.10.6
func FinishWithAdditionalTags(tags map[string]interface{}) FinishOptionFunc
FinishWithAdditionalTags option for add tag when finish
func FinishWithError ¶ added in v1.10.6
func FinishWithError(err error) FinishOptionFunc
FinishWithError option for add error when finish
func FinishWithFunc ¶ added in v1.17.0
func FinishWithFunc(finishFunc func()) FinishOptionFunc
FinishWithFunc option for add callback function before finish span
func FinishWithRecoverPanic ¶ added in v1.17.0
func FinishWithRecoverPanic(recoverFunc func(panicMessage any)) FinishOptionFunc
FinishWithRecoverPanic option for add recover func if panic
func FinishWithStackTraceDetail ¶ added in v1.15.7
func FinishWithStackTraceDetail() FinishOptionFunc
FinishWithStackTraceDetail option for add stack trace detail
type Option ¶ added in v1.6.8
type Option struct {
// contains filtered or unexported fields
}
Option for init tracer option
type OptionFunc ¶ added in v1.6.8
type OptionFunc func(*Option)
OptionFunc func
func OptionSetAgentHost ¶ added in v1.6.8
func OptionSetAgentHost(agent string) OptionFunc
OptionSetAgentHost option func
func OptionSetBuildNumberTag ¶ added in v1.6.8
func OptionSetBuildNumberTag(number string) OptionFunc
OptionSetBuildNumberTag option func
func OptionSetErrorWhitelist ¶ added in v1.17.0
func OptionSetErrorWhitelist(errs []error) OptionFunc
OptionSetErrorWhitelist option func, set no error if error in whitelist
func OptionSetLevel ¶ added in v1.6.8
func OptionSetLevel(level string) OptionFunc
OptionSetLevel option func
func OptionSetLogAllSpan ¶ added in v1.17.0
func OptionSetLogAllSpan() OptionFunc
OptionSetLogAllSpan option func
func OptionSetMaxGoroutineTag ¶ added in v1.6.8
func OptionSetMaxGoroutineTag(max int) OptionFunc
OptionSetMaxGoroutineTag option func
func OptionSetTraceDashboardURL ¶ added in v1.12.2
func OptionSetTraceDashboardURL(dashboardURL string) OptionFunc
OptionSetTraceDashboardURL option func
func OptionSetTraceIDExtractor ¶ added in v1.17.0
func OptionSetTraceIDExtractor(extractor func(context.Context) string) OptionFunc
OptionSetTraceIDExtractor option func, set trace id extractor
type PlatformType ¶ added in v1.9.3
type PlatformType interface { StartSpan(ctx context.Context, opName string) Tracer StartRootSpan(ctx context.Context, operationName string, header map[string]string) Tracer GetTraceID(ctx context.Context) string GetTraceURL(ctx context.Context) string interfaces.Closer }
PlatformType define tracing platform. example using jaeger, sentry, aws x-ray, etc
func InitJaeger ¶ added in v1.17.0
func InitJaeger(serviceName string, opts ...OptionFunc) PlatformType
InitJaeger init jaeger tracing
type Tracer ¶ added in v1.10.6
type Tracer interface { Context() context.Context NewContext() context.Context SetTag(key string, value interface{}) InjectRequestHeader(header map[string]string) SetError(err error) Log(key string, value interface{}) Finish(opts ...FinishOptionFunc) }
Tracer for trace
func StartTrace ¶
StartTrace starting trace child span from parent span