requeststats

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package requeststats measures work attached to one development request. It retains counters and durations only, never SQL, arguments or user data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware instruments non-streaming API responses in development. The frontend has its own timing boundaries for data loading and rendering. httpsnoop preserves the optional ResponseWriter interfaces used by handlers.

Types

type Snapshot

type Snapshot struct {
	Server, Load, Render, Database, PoolWait time.Duration
	Queries, Errors, Batches, Copies         int
}

func (Snapshot) ServerTiming

func (s Snapshot) ServerTiming() string

ServerTiming uses durations only for time metrics. Counts use descriptions, so DevTools doesn't present a query count as a fictional duration.

type Stats

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

func From

func From(ctx context.Context) *Stats

func Start

func Start(ctx context.Context) (context.Context, *Stats)

func (*Stats) AddBatch

func (s *Stats) AddBatch()

func (*Stats) AddCopy

func (s *Stats) AddCopy()

func (*Stats) AddDatabase

func (s *Stats) AddDatabase(d time.Duration, failed bool)

func (*Stats) AddLoad

func (s *Stats) AddLoad(d time.Duration)

func (*Stats) AddPoolWait

func (s *Stats) AddPoolWait(d time.Duration)

func (*Stats) AddQuery

func (s *Stats) AddQuery()

func (*Stats) AddRender

func (s *Stats) AddRender(d time.Duration)

func (*Stats) Snapshot

func (s *Stats) Snapshot() Snapshot

Jump to

Keyboard shortcuts

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