userclass

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(e Entry)

Add registers a user class Entry. It panics if an entry with the same Name is already registered.

func Names

func Names() []string

Names returns a sorted slice of all registered user class names.

Types

type Config

type Config struct {
	// APIStub is the shared gRPC client to ateapi (one connection, all goroutines).
	APIStub ateapi.ControlClient
	// HTTPClient is the shared HTTP client for atenet pings.
	HTTPClient *http.Client
	// RouterURL is the base URL of the atenet router (no trailing slash).
	RouterURL string
	// Atespace every actor this worker creates lives in. Required; caller
	// is responsible for having ensured it exists (see EnsureAtespace).
	Atespace string
	// Dyn is the runtime-mutable config, built from the class's
	// Entry.Config codec. Required: a class reads its typed knobs from it
	// through dynconfig.Get on every iteration, so tests can swap the
	// holder without touching class internals.
	Dyn *dynconfig.Holder
	// Tracer anchors sampled spans; falls back to the otel global if nil.
	Tracer trace.Tracer
	// ActorsPerUser is the number of actors each VU creates on startup and
	// cycles through in round-robin (iteration i targets actor
	// i%ActorsPerUser). Zero or negative is treated as 1 by user classes
	// that honor this knob; classes that don't honor it treat every VU as
	// owning exactly one actor.
	ActorsPerUser int
	// TotalActors is the total number of actors to create in the batch (spawn benchmark).
	TotalActors int
	// SpawnConcurrency is the number of actors created concurrently (spawn benchmark).
	SpawnConcurrency int
	// ActorDeadline is the per-actor timeout covering CreateActor + ResumeActor + Ping (spawn benchmark).
	ActorDeadline time.Duration
}

Config holds the dependencies a user class needs. Built once at startup and passed to the entry's Init func.

type Entry

type Entry struct {
	// Name is the --user-class flag value that selects this class.
	Name string
	// LocustFile is the tests/<file> the Locust master loads for it.
	LocustFile string
	// UserClass is the Python class name. It must equal boomer.Task.Name or
	// the master's spawn messages never match and no users start.
	UserClass string
	// Config is the class's runtime config codec: a dynconfig.Typed over
	// the struct it reads its knobs from, with its defaults and rules. The
	// worker builds the holder from it, so a payload the class cannot run
	// on is refused at fetch time rather than failing in the middle of a
	// run. Nil when the class reads no runtime config.
	Config dynconfig.Codec
	// Init builds the boomer task func and its shutdown hook.
	Init func(*Config) (task func(), shutdown func(context.Context))
}

Entry declares one user class: the flag value that selects it, the Locust file and Python class it pairs with, and the func that builds its task.

func Lookup

func Lookup(name string) (Entry, bool)

Lookup returns the Entry registered under name, or false if not found.

Jump to

Keyboard shortcuts

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