stats

package
v0.0.0-...-86cb477 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Elapsed

func Elapsed(ctx context.Context, name string) func()

Elapsed records as a stat the elapsed time for a function execution. Invoke like so:

defer Elapsed(ctx, "FunctionName")()

The resulting stat will be called "FunctionName ms" and will be the wall-clock execution time of the function in milliseconds.

func Stats

func Stats() func(http.Handler) http.Handler

Stats returns a Middleware that, instead of serving the page, serves statistics about the page.

Types

type PageStats

type PageStats struct {
	MillisToFirstByte int64
	MillisToLastByte  int64
	Hash              uint64 // hash of page contents
	Size              int    // total size of data written
	StatusCode        int    // HTTP status
	Other             map[string]any
}

Jump to

Keyboard shortcuts

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