JSON stream data generator
- Go 99.7%
- Dockerfile 0.3%
| file | file docs | |
| generator | file testing | |
| parser | file testing | |
| plots | file docs | |
| sink | improved event scheduling | |
| testing | file testing | |
| .gitignore | init parser | |
| docker-compose.yaml | rocketmq init | |
| Dockerfile | file docs | |
| go.mod | init copula generation | |
| go.sum | init copula generation | |
| LICENSE | Initial commit | |
| main.go | file testing | |
| README.md | file docs | |
| tutorial.md | file docs | |
anystream
JSON stream data generator. Produces random data with user-defined types and sends it to:
- stdout
- unix socket
- websocket
- sse
- amqp
- kafka
- nats
- pulsar
- mqtt
- nsq
- valkey streams
- rocketmq
- more
Installation
Options:
- Download compiled binary from releases page
- Use docker image
codeberg.org/ppatrzyk/anystream - Build
Usage
See tutorial for more examples.
Options
Example usage:
anystream \
-f "ts timestamp ms" \
-f "meta.age uniform 18 100" \
-f "meta.height normal 170 10" \
-f "meta.gender categorical male female unknown" \
-f "results pareto[5] 100 3" \
-e 5
For all options, see:
anystream -h
Field definition
| data_type | args | example |
|---|---|---|
| bernoulli | p | is_customer bernoulli 0.8 |
| categorical | any number > 0 | gender categorical male female unknown |
| normal | mean, std | height normal 170 10 |
| pareto | xm, alpha | income pareto 1000 2 |
| gamma | alpha, beta | waiting gamma 1 0.5 |
| beta | alpha, beta | probability beta 0.5 0.5 |
| poisson | lambda | visits poisson 5 |
| poissonnhpp | baseline, (period, center, std, amplitude) | visits poissonnhpp 5 60 2 0.5 50 |
| timeformatted | format | event_iso timeformatted %Y-%m-%dT%H:%M:%S%:z |
| timepart | part* | event_hour timepart hour |
| timestamp | unit** | event_ts timestamp ms |
| uniform | min, max | age uniform 0 100 |
| uuid | - | event_id uuid |
| serial | from | serial_id serial 1 |
| serialtimed | from, unit** | serial_id serial 1 s |
| null | - | extra null |
| file | path, strategy*** | file test_data.parquet sample |
*part: [year, month, day, weekday, hour, minute, s, ms, micros, ns, ]
** unit: [s, ms, micros, ns, ]
*** strategy: [sample, copula, ]
All data types take optional [<n>] suffix for generating list of values.
E.g. uuid produces single value, uuid[5] produces list of 5 values.
Fields can be nested using parent.child syntax in field name.
Testing
podman-compose up -d
go test -v ./...
Build
gox \
-os="darwin linux" \
-arch="amd64 arm64" \
-output="anystream_v0.11_{{.OS}}_{{.Arch}}" \
-ldflags="-s -w"
# docker
sudo podman build . -t codeberg.org/ppatrzyk/anystream:0.11