abtest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 2 Imported by: ? 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

Overview

Package abtest provides protocol A/B testing framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Experiment

type Experiment struct {
	Name     string    `json:"name"`
	Protocol string    `json:"protocol"`
	Variants []Variant `json:"variants"`
}

Experiment represents an A/B test experiment.

func NewExperiment

func NewExperiment(name, protocol string) *Experiment

NewExperiment creates a new A/B test experiment.

func (*Experiment) AddVariant

func (e *Experiment) AddVariant(name, version string, weight float64)

AddVariant adds a variant.

func (*Experiment) Analyze

func (e *Experiment) Analyze() string

Analyze analyzes experiment results and returns a recommendation.

type Metrics

type Metrics struct {
	Latency    float64 `json:"latency_ms"`
	ErrorRate  float64 `json:"error_rate"`
	Throughput float64 `json:"throughput_rps"`
}

Metrics holds performance metrics for a variant.

type Variant

type Variant struct {
	Name    string  `json:"name"`
	Version string  `json:"version"`
	Weight  float64 `json:"weight"` // 0.0-1.0
	Metrics Metrics `json:"metrics"`
}

Variant represents a protocol version variant.

Jump to

Keyboard shortcuts

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