Skip to content

relay: the pprof upstream kind - #9

Merged
tsenart merged 1 commit into
mainfrom
pprof-kind
Sep 30, 2026
Merged

tsenart merged 1 commit into
mainfrom
pprof-kind

Conversation

@tsenart

@tsenart tsenart commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds the pprof upstream kind. A user names Go processes as targets. The relay permits only GET requests to the six documented profiling routes, with seconds as the only query key. Duration is bounded by max_seconds (default 30, at most 45), and max_concurrent limits concurrent requests per process (default 1). Unknown targets, routes, methods, and queries are refused before reaching a process; a busy target returns 429 immediately. Route printing includes the targets and limits. The shared link package exposes the corresponding error and limit values.

Recorded proof: go vet and go test -race ./... passed, including refusal-boundary tests, the concurrency limit, and fuzz tests for routes and duration values.

A customer names Go processes as targets of one pprof upstream; Perfloop
names one target per read as the first path segment. The relay forwards
only GET to the six documented /debug/pprof routes, admits `seconds` as
the only query key within the configured cap (profile must carry it), and
refuses a further read at once when the per-process in-flight cap is
reached. Every refusal happens before any upstream request and carries
the relay's own marker on Perfloop-Relay-Error, so a reader tells it
from the process's answer. -print-routes lists each target and the caps,
per process. link carries the marker values and the seconds bound both
ends share.

Ported from perfloop/perfloop#4331 (0bf7906fc8, 2a5fec2b88, 53d50ae9de,
1ecd357bf0, aebcedfdd9, a1a05b8c96) over the hardening in ce5260e.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tsenart
tsenart merged commit 495db17 into main Sep 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant