stats

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlankContextWithRequestStats added in v0.32.2

func BlankContextWithRequestStats(parent context.Context) context.Context

Returns a blank context with only parent's existing *RequestStats (if present).

func ContextWithTagCrumb added in v0.27.0

func ContextWithTagCrumb(ctx context.Context, crumb string) context.Context

Returns a new context with given crumb appended to existing tag, if present. Otherwise, tracks the new tag in returned context. Useful for adding breadcrumbs to a Stat prior to a recording it.

func RecordStat added in v0.27.0

func RecordStat(ctx context.Context, store string, tag string, start time.Time)

Append a new Stat to the RequestStats obj in provided context, if present.

func RequestStatsMiddleware added in v0.27.0

func RequestStatsMiddleware(next http.Handler) http.Handler

Create & inject a 'per-request' stats object into request context.

Types

type RequestStats

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

func GetRequestStatsFromContext added in v0.27.0

func GetRequestStatsFromContext(ctx context.Context) *RequestStats

Get RequestStats from ctx, if present.

func (*RequestStats) MarshalZerologObject

func (s *RequestStats) MarshalZerologObject(e *zerolog.Event)

func (*RequestStats) NumStats added in v1.0.2

func (s *RequestStats) NumStats() int

func (*RequestStats) RecordStat added in v1.0.2

func (s *RequestStats) RecordStat(stat Stat)

type Stat added in v0.27.0

type Stat struct {
	Store    string
	Tag      string
	Duration time.Duration
}

func (Stat) MarshalZerologObject added in v0.27.0

func (s Stat) MarshalZerologObject(e *zerolog.Event)

Jump to

Keyboard shortcuts

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