rpcstat

package
v0.1.90-dev.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rpcstat counts the admin API's calls over the last few minutes: how many, how many failed, and how long the unary ones took. It is a fixed array of one-minute slots with a latency histogram each, so it never allocates after New and its memory does not grow with the traffic. The HTTP middleware records every /api call; OpsService GetPanelResources reads it.

Index

Constants

View Source
const Minutes = 5

Minutes is the window: the last Minutes whole minutes, the current one included.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

type Snapshot struct {
	WindowS                              int
	Requests, ServerErrors, ClientErrors uint64
	// P95ms is the 95th percentile of the unary calls' time, read from the histogram (linear inside its bucket); 0 without
	// calls.
	P95ms float64
}

Snapshot is the window's counts.

type Window

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

Window holds the counts. The zero value is not usable; a nil *Window records nothing and reads as empty.

func New

func New(now func() time.Time) *Window

New returns an empty window on the real clock (now nil) or on now.

func (*Window) Record

func (w *Window) Record(status int, d time.Duration, stream bool)

Record counts one call that ended with status after d. A stream's duration is how long it was open, not how long the panel took to answer, so it is counted but kept out of the latency.

func (*Window) Snapshot

func (w *Window) Snapshot() Snapshot

Snapshot adds up the slots that are still inside the window.

Jump to

Keyboard shortcuts

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