https://github.com/boylegu/regal-go
A/B Testing or gray released smart grouping engine
https://github.com/boylegu/regal-go
ab-test golang gray-release
Last synced: 8 months ago
JSON representation
A/B Testing or gray released smart grouping engine
- Host: GitHub
- URL: https://github.com/boylegu/regal-go
- Owner: boylegu
- License: other
- Created: 2024-04-25T14:56:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-25T08:59:57.000Z (about 2 years ago)
- Last Synced: 2025-10-13T12:06:07.137Z (8 months ago)
- Topics: ab-test, golang, gray-release
- Language: Go
- Homepage:
- Size: 640 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Regal-Go
The smart grouping engine for A/B Testing or Gray release by Golang.
[]()
[]()
[](https://codeclimate.com/github/boylegu/regal-go/maintainability)
[]()
English | [简体中文](https://github.com/boylegu/regal-go/blob/main/README.zh-CN.md) | [Regal by Python](https://github.com/boylegu/regal)
## what's Regal-Go
For example, let's say you need to do a staged rollout for a particular version or several, which could be a bunch of server clusters, as shown in the following diagram:
The regal-go provides two policies:
- Combine
Number of machines in each group.
- Schedule
As the first group of A/B, the default is 1.
You can change this behavior by using the 'schedule' parameter.
>> See the example for more details.
## Feature
1. Provide A/B Test or Gray release policies and dynamic intelligent distribution;
2. Support multi-version grouping and priority;
3. Lightweight and scalable;
## Examples
See [./example](./example) for example usage.
### Example-1
```go
package main
import (
"fmt"
"github.com/boylegu/regal-go"
)
func main() {
var example1 = [][]string{
{"app-test-ver1", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5"},
}
c1 := regal.RegalEngine(example1, regal.WithCombine(2))
fmt.Println(c1.Grouping())
}
```
Output:
```shell
[root@gbe-pcx example]# go run main.go
[[app-test-version1.0 [[10.1.1.1] [10.1.1.2 10.1.1.3] [10.1.1.4 10.1.1.5]]]]
```
Based on policy, you will get a data structure. Let's take a look at it:
### Example-2
```go
var example2 = [][]string{
{"ver1", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5,10.1.1.6"},
{"ver2", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5"},
{"ver3", "10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5"},
}
c2 := regal.RegalEngine(
example2,
regal.WithCombine(3),
regal.WithSchedule(2),
regal.WithPriorKey("ver2"), // Set priority
)
for _, v := range c2.Grouping() {
fmt.Println(v)
}
```
Output:
```shell
[root@gubaoer-pcx example]# go run main.go
[ver2 [[10.1.1.1, 10.1.1.2] [10.1.1.3 10.1.1.4 10.1.1.5]]]
[ver1 [[10.1.1.1, 10.1.1.2] [10.1.1.3 10.1.1.4 10.1.1.5] [10.1.1.6]]]
[ver3 [[10.1.1.1, 10.1.1.2] [10.1.1.3 10.1.1.4 10.1.1.5]]]
```
### Darwin's finches
Human creation has never left the inspiration brought to us by nature, and whether it is gray release or A/B testing, nature had excellent solutions thousands of years ago.
Therefore, I use 'Darwin's finches' as the prototype to pay tribute to the great nature and Darwin's 《ORIGIN OF SPECIES》.
> Author: Boyle Gu. Drawing with DeepAI in 2024.