Expand description
In-process profiling admin server.
On Unix targets, the server always serves a CPU pprof profile at
GET /debug/pprof/profile?seconds=N. With the heap-profiling feature,
which needs jemalloc, the server also serves a heap pprof profile at
GET /debug/pprof/heap. Grafana Alloy pyroscope.scrape scrapes both. The
same admin server can carry more routes, for example /metrics.
The bodies are gzipped Profile protobufs. This is the standard pprof file
format, and it is what Go’s net/http/pprof serves. Alloy’s
pyroscope.scrape forwards the scraped bytes without a change as the push
API’s raw_profile, and the ingester gunzips them. An uncompressed
protobuf body makes that gunzip fail with “invalid gzip header”.
CPU profiling uses POSIX signals, so it is available only on Unix. On
non-Unix targets the server returns a 503 stub, and the crate thus compiles
on all platforms. On wasm32-wasip1 there is no server at all, because the
admin server binds its own socket: the module exports only the
configuration types there.
Structs§
- Profiling
Config - Process-local CPU and heap profiling policy.
- Profiling
Sample Frequency - A positive, finite, whole-Hz sampling frequency accepted by
pprof, whose frequency input is a signedint.
Enums§
- Profiling
Error - Profiling configuration or admin-server failure.
Functions§
- await_
admin_ exit - Wait for a supervised admin task, treating every terminal outcome as an error.
- pprof_
router - The pprof routes with the compatible default policy.
- pprof_
router_ with_ config - The pprof routes with an explicit policy.
- serve_
admin - Bind an admin HTTP server on
addr. - serve_
admin_ from_ env - Like
serve_admin, but with the bind address from the environment. - serve_
admin_ from_ env_ with - Like
serve_admin_from_env, but it also mergesextrawith the pprof routes. - serve_
admin_ from_ env_ with_ config - Like
serve_admin_from_env_withwith explicit profiling policy. - serve_
admin_ with_ config - Bind a profiling admin server with explicit policy.
- spawn_
admin_ from_ env_ with_ config - Environment-address variant of
spawn_admin_with_config. - spawn_
admin_ with_ config - Bind a profiling admin server and return its task for lifecycle supervision.