timing

package
v0.0.0-...-af321b4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTracker

func WithTracker(ctx context.Context, t Tracker) context.Context

Types

type DefaultMetric

type DefaultMetric struct {
	Name      string
	StartTime time.Time
	StopTime  time.Time
}

func (*DefaultMetric) Start

func (d *DefaultMetric) Start() Metric

func (*DefaultMetric) Stop

func (d *DefaultMetric) Stop()

type DefaultTracker

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

func (*DefaultTracker) NewMetric

func (d *DefaultTracker) NewMetric(name string) Metric

func (*DefaultTracker) Spans

func (d *DefaultTracker) Spans() []Span

type Metric

type Metric interface {
	Start() Metric
	Stop()
}

func Track

func Track(ctx context.Context, name string) Metric

type Span

type Span struct {
	Name     string
	Duration time.Duration
}

type Tracker

type Tracker interface {
	NewMetric(name string) Metric
	Spans() []Span
}

func FromContext

func FromContext(ctx context.Context) Tracker

Jump to

Keyboard shortcuts

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