spxreport

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package spxreport reads the SPX profiler's on-disk captures and distills each into a handful of timing outliers. SPX writes one report per profiled request as a .json metadata sidecar (method, host, uri, timings) plus a gzipped .txt event trace. This package turns the freshest capture of a route into the top functions by exclusive wall time, so the join in optimize_route can hand an agent the CPU hotspots behind a slow route rather than a 400k-line trace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProfilesForRoutes

func ProfilesForRoutes(dataDir string, hosts, routes []string, topN int, minPct float64) map[string]Profile

ProfilesForRoutes scans dataDir once and, for each of the wanted normalized routes served on one of hosts, parses the freshest matching capture into its top hotspots. Routes with no capture (profiler was off, or the route was not hit while profiling) are simply absent from the returned map.

Types

type Hotspot

type Hotspot struct {
	Function string  `json:"function"`
	ExclMS   float64 `json:"excl_ms"`
	Calls    int     `json:"calls"`
	Pct      float64 `json:"pct"`
}

Hotspot is one function's share of a request's wall time. Exclusive time (self, not descendants) is what points at the code to change.

type Profile

type Profile struct {
	CapturedAt time.Time `json:"captured_at"`
	Method     string    `json:"method"`
	URI        string    `json:"uri"`
	WallMS     float64   `json:"wall_ms"`
	Hotspots   []Hotspot `json:"hotspots"`
}

Profile is the distilled view of one capture: when it was taken, the request it came from, its total wall time, and only the top timing outliers.

Jump to

Keyboard shortcuts

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