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

observability

package
v1.31.9 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContextWithTraceId added in v1.4.2

func GetContextWithTraceId(ctx context.Context, traceId string) context.Context

GetContextWithTraceId Returns a child context with "trace_id" set to the given traceId

func GetTraceId added in v1.14.0

func GetTraceId(ctx context.Context) (string, error)

Types

type ErrorReporter added in v0.3.0

type ErrorReporter interface {
	FlushErrorReporting()
	CaptureError(err error, options ErrorReporterOptions) bool
}

func NewErrorReporter added in v1.4.2

func NewErrorReporter(logger *zerolog.Logger) ErrorReporter

type ErrorReporterOptions added in v0.3.1

type ErrorReporterOptions struct {
	ErrorDiagnosticPath string
}

type Instrumentor

type Instrumentor interface {
	StartSpan(ctx context.Context, operation string) Span
	NewTransaction(
		ctx context.Context,
		txName string,
		operation string,
	) Span
	Finish(span Span)
}

Instrumentor exposes functions used for adding instrumentation context to functions.

func NewInstrumentor added in v1.4.2

func NewInstrumentor() Instrumentor

type NoopSpan added in v1.4.2

type NoopSpan struct {
	Operation string
	TxName    string
	Started   bool
	Finished  bool

	StartTime  int64
	FinishTime int64
	// contains filtered or unexported fields
}

func NewNoopSpan added in v1.4.2

func NewNoopSpan(ctx context.Context, operation string, txName string, started bool, finished bool) *NoopSpan

func (*NoopSpan) Context added in v1.4.2

func (n *NoopSpan) Context() context.Context

func (*NoopSpan) Finish added in v1.4.2

func (n *NoopSpan) Finish()

func (*NoopSpan) GetDurationMs added in v1.4.2

func (n *NoopSpan) GetDurationMs() int64

func (*NoopSpan) GetOperation added in v1.4.2

func (n *NoopSpan) GetOperation() string

func (*NoopSpan) GetTraceId added in v1.4.2

func (n *NoopSpan) GetTraceId() string

func (*NoopSpan) GetTxName added in v1.4.2

func (n *NoopSpan) GetTxName() string

func (*NoopSpan) SetTransactionName added in v1.4.2

func (n *NoopSpan) SetTransactionName(txName string)

func (*NoopSpan) StartSpan added in v1.4.2

func (n *NoopSpan) StartSpan(ctx context.Context)

type Span

type Span interface {
	SetTransactionName(name string)
	StartSpan(ctx context.Context)
	Finish()
	GetOperation() string
	GetTxName() string

	// GetTraceId Returns UUID of the trace
	GetTraceId() string
	Context() context.Context

	GetDurationMs() int64
}

Span exposes functions that have context about functions.

type SpanRecorder added in v1.4.2

type SpanRecorder interface {
	Record(span Span)
	Spans() []Span
	ClearSpans()
	Finish(span Span)
}

type TraceIdContextKey added in v1.4.2

type TraceIdContextKey string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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