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: 0

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