Help us shape the future of Go! Take the 2026 Go Developer Survey

gtprof

package
v3.1.61 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TraceSpanHTTP     = "http"
	TraceSpanGitRun   = "git-run"
	TraceSpanDatabase = "database"
)
View Source
const (
	TraceAttrFuncCaller = "func.caller"
	TraceAttrDbSQL      = "db.sql"
	TraceAttrGitCommand = "git.command"
	TraceAttrHTTPRoute  = "http.route"
)
View Source
const LabelGracefulLifecycle = "graceful_lifecycle"

LabelGracefulLifecycle is a label marking manager lifecycle phase Making it compliant with prometheus key regex https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels would enable someone interested to be able to continuously gather profiles into pyroscope. Other labels for pprof should also follow this rule.

View Source
const LabelPid = "pid"

LabelPid is a label set on goroutines that have a process attached

View Source
const LabelPpid = "ppid"

LabelPpid is a label set on goroutines that have a process attached

View Source
const LabelProcessDescription = "process_description"

LabelProcessDescription is a label set on goroutines that have a process attached

View Source
const LabelProcessType = "process_type"

LabelProcessType is a label set on goroutines that have a process attached

Variables

This section is empty.

Functions

func EnableBuiltinTracer

func EnableBuiltinTracer(threshold time.Duration)

Types

type EventConfig

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

type EventOption

type EventOption interface {
	// contains filtered or unexported methods
}

func WithAttributes

func WithAttributes(attrs ...*TraceAttribute) EventOption

type TraceAttribute

type TraceAttribute struct {
	Key   string
	Value TraceValue
}

type TraceSpan

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

func GetContextSpan

func GetContextSpan(ctx context.Context) *TraceSpan

func (*TraceSpan) AddEvent

func (s *TraceSpan) AddEvent(name string, options ...EventOption)

func (*TraceSpan) End

func (s *TraceSpan) End()

func (*TraceSpan) RecordError

func (s *TraceSpan) RecordError(err error, options ...EventOption)

func (*TraceSpan) SetAttributeString

func (s *TraceSpan) SetAttributeString(key, value string) *TraceSpan

func (*TraceSpan) SetName

func (s *TraceSpan) SetName(name string)

func (*TraceSpan) SetStatus

func (s *TraceSpan) SetStatus(code uint32, desc string)

type TraceValue

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

func (*TraceValue) AsFloat64

func (t *TraceValue) AsFloat64() float64

func (*TraceValue) AsInt64

func (t *TraceValue) AsInt64() int64

func (*TraceValue) AsString

func (t *TraceValue) AsString() string

type Tracer

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

func GetTracer

func GetTracer() *Tracer

func (*Tracer) Start

func (t *Tracer) Start(ctx context.Context, spanName string) (context.Context, *TraceSpan)

func (*Tracer) StartInContext

func (t *Tracer) StartInContext(ctx mutableContext, spanName string) (*TraceSpan, func())

StartInContext starts a trace span in Gitea's mutable context (usually the web request context). Due to the design limitation of Gitea's web framework, it can't use `context.WithValue` to bind a new span into a new context. So here we use our "reqctx" framework to achieve the same result: web request context could always see the latest "span".

Source Files

  • event.go
  • gtprof.go
  • trace.go
  • trace_builtin.go
  • trace_const.go

Jump to

Keyboard shortcuts

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