Documentation
¶
Overview ¶
Package wire converts between Stampede's in-memory metrics and the worker protocol messages, and holds the protocol version both sides negotiate. Keeping the conversions in one place means the worker and the coordinator cannot disagree on how a snapshot is encoded.
Index ¶
- Constants
- func CheckVersion(v *workerv1.ProtocolVersion) error
- func HealthToProto(h *Health) *workerv1.Health
- func MergePhases(dst, src map[int]*[metrics.NumPhases]*metrics.Histogram)
- func PhasesFromProto(p map[int32]*workerv1.PhaseHistograms) (map[int]*[metrics.NumPhases]*metrics.Histogram, error)
- func PhasesToProto(ph map[int]*[metrics.NumPhases]*metrics.Histogram) (map[int32]*workerv1.PhaseHistograms, error)
- func SnapshotToProto(runID string, s *metrics.Snapshot, h *Health) (*workerv1.Snapshot, error)
- func Version() *workerv1.ProtocolVersion
- type Health
Constants ¶
const ( ProtocolMajor = 1 // 1.3: browser phases (fcp, lcp, cls, inp, load). 1.4: busy_elsewhere // heartbeats and mid-run takeover (StartRun resume_ns and attempt). // 1.5: error examples in step snapshots. ProtocolMinor = 5 )
Protocol version spoken by this build. Minor versions only add fields, so any minor of the same major interoperates.
Variables ¶
This section is empty.
Functions ¶
func CheckVersion ¶
func CheckVersion(v *workerv1.ProtocolVersion) error
CheckVersion returns an error explaining why a peer speaking v cannot be served. A missing version is treated as incompatible: every build that speaks this protocol sends one.
func HealthToProto ¶
HealthToProto encodes h. A nil h encodes as nil.
func MergePhases ¶
MergePhases adds src into dst, creating entries as needed.
func PhasesFromProto ¶
func PhasesFromProto(p map[int32]*workerv1.PhaseHistograms) (map[int]*[metrics.NumPhases]*metrics.Histogram, error)
PhasesFromProto decodes PhasesToProto output.
func PhasesToProto ¶
func PhasesToProto(ph map[int]*[metrics.NumPhases]*metrics.Histogram) (map[int32]*workerv1.PhaseHistograms, error)
PhasesToProto encodes run-wide per-step phase histograms.
func SnapshotToProto ¶
SnapshotToProto encodes one worker snapshot for a run.
func Version ¶
func Version() *workerv1.ProtocolVersion
Version is the protocol version as a message.
Types ¶
type Health ¶
type Health struct {
Saturated bool `json:"saturated"`
Reasons []string `json:"reasons,omitempty"`
CPUPercent float64 `json:"cpuPercent"`
SchedLagP99 time.Duration `json:"schedLagP99"`
GCPauseP99 time.Duration `json:"gcPauseP99"`
OpenFDs uint64 `json:"openFDs"`
FDLimit uint64 `json:"fdLimit"`
Goroutines int `json:"goroutines"`
Dropped uint64 `json:"dropped"`
}
Health is a worker's self-monitoring for one sample (normally one second). Saturated means the worker itself, not the target, may be what limits the measured load.
func HealthFromProto ¶
HealthFromProto decodes p. A nil p decodes as nil.