distributed

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package distributed contains the wire types and HTTP transport used for distributed Pulse runs. Workers expose POST /run and GET /ping over HTTP/JSON. The coordinator fans out RunRequests to all workers and merges WorkerResults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPScenario

type HTTPScenario struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Headers map[string]string `json:"headers,omitempty"`
	Body    string            `json:"body,omitempty"`
}

HTTPScenario describes the HTTP request a worker should generate when it has no pre-registered scenario (CLI worker mode). Workers that were started with a pre-registered scenario via ListenAsWorker ignore this field.

type LatencyStats

type LatencyStats struct {
	Min  time.Duration `json:"min"`
	Mean time.Duration `json:"mean"`
	P50  time.Duration `json:"p50"`
	P90  time.Duration `json:"p90"`
	P95  time.Duration `json:"p95"`
	P99  time.Duration `json:"p99"`
	Max  time.Duration `json:"max"`
}

LatencyStats is a wire-safe latency summary using nanosecond int64 durations.

type Phase

type Phase struct {
	Type          string        `json:"type"`
	Duration      time.Duration `json:"duration"`
	ArrivalRate   int           `json:"arrivalRate"`
	From          int           `json:"from"`
	To            int           `json:"to"`
	Steps         int           `json:"steps"`
	SpikeAt       time.Duration `json:"spikeAt"`
	SpikeDuration time.Duration `json:"spikeDuration"`
}

Phase is the wire representation of a load-test phase sent to a worker. Durations are encoded as int64 nanoseconds by the standard time.Duration JSON marshaling.

type PingResponse

type PingResponse struct {
	Status string `json:"status"`
}

PingResponse is the JSON body returned by GET /ping.

type RunRequest

type RunRequest struct {
	Phases           []Phase `json:"phases"`
	MaxConcurrency   int     `json:"maxConcurrency"`
	SaturationPolicy string  `json:"saturationPolicy"`
	// HTTPScenario is set by the coordinator when workers should build a built-in
	// HTTP scenario from scratch (CLI distributed mode). When nil, workers use
	// their pre-registered scenario (library distributed mode).
	HTTPScenario *HTTPScenario `json:"httpScenario,omitempty"`
}

RunRequest is the JSON body the coordinator POSTs to /run on each worker. Workers execute the phases at the specified arrival rate and return a WorkerResult.

type WorkerResult

type WorkerResult struct {
	Total       int64         `json:"total"`
	Failed      int64         `json:"failed"`
	Duration    time.Duration `json:"duration"`
	Scheduled   int64         `json:"scheduled"`
	Started     int64         `json:"started"`
	Dropped     int64         `json:"dropped"`
	DroppedRate float64       `json:"droppedRate"`
	Completed   int64         `json:"completed"`
	MaxActive   int64         `json:"maxActive"`
	Latency     LatencyStats  `json:"latency"`
	// StatusCounts keys are decimal HTTP status codes (e.g. "200", "404").
	StatusCounts map[string]int64 `json:"statusCounts"`
	ErrorCounts  map[string]int64 `json:"errorCounts"`
	// Buckets contains the 800 histogram bucket counts exported from the worker's
	// stats.Engine. The coordinator sums these across all workers and imports them
	// into a fresh engine to compute accurate merged latency percentiles.
	Buckets []uint64 `json:"buckets"`
}

WorkerResult is the JSON body returned by a worker when a run completes. StatusCounts uses string keys because JSON only allows string map keys.

Directories

Path Synopsis
Package coordinator implements the Pulse distributed coordinator.
Package coordinator implements the Pulse distributed coordinator.
Package merger combines multiple WorkerResult values from distributed workers into a single metrics.Result.
Package merger combines multiple WorkerResult values from distributed workers into a single metrics.Result.
Package worker implements the Pulse distributed worker HTTP server.
Package worker implements the Pulse distributed worker HTTP server.

Jump to

Keyboard shortcuts

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