Documentation
¶
Overview ¶
Package activity tracks one service instance's request activity: how many requests are in flight right now, how many have been served, and when the last one started. A Counter is created per service per server in the runtime and shared by reference between the request-handling choke points that feed it (the gRPC appctx interceptor, the HTTP router) and the built-in `activity` invocation that reports it — no process-global state, and one counter per listener means the granularity matches a node id (per instance). The signal backs the "is this instance still serving requests?" question during a drain and restart: in-flight zero, plus an idle window, means quiesced.
This is a leaf with no reva dependencies, so every layer that touches a Counter can do so without an import cycle. All methods are nil-safe: a nil *Counter (a service with no counter wired, e.g. serverless) reads as idle and silently drops writes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter accumulates one service instance's request activity: an aggregate (lock-free atomics, so the quiescence check stays cheap) plus a lazily-built per-method breakdown.
type Stat ¶
type Stat struct {
InFlight int64 // requests currently being served
Total int64 // requests served since the process started
LastRequest time.Time // start of the most recent request (zero if none)
Methods map[string]Stat
}
Stat is a point-in-time view of one service's request activity. Methods holds the per-RPC-method breakdown on the aggregate snapshot (nil on a per-method entry).