Caduceator provides a way to performance test Caduceus, which is a part of XMiDT.
This project and everyone participating in it are governed by the XMiDT Code Of Conduct. By participating, you agree to this Code.
Caduceator's function is to send and recieve events from Caduceus and calculate how long it has been cutoff as a consumer of Caduceus.
Caduceator has two endpoints: 1) receiving events, and 2) receiving cutoffs.
The events endpoint will be able to recieve events from Caduceus after registering a webhook to Caduceus' /hook
endpoint. Caduceator will then give a response back to Caduceus based on reading the body of the request.
The cutoff endpoint is hit in Caduceator when Caduceus cutsoff its consumers due to its queue being full. Once the cutoff endpoint is reached, a timer will start and continue until Caduceus empties its queue and is able to send events again to its consumers. The total time it takes to empty is queue is then recorded and saved as a metric.
In order to build from the source, you need a working Go environment with version 1.13 or greater. Find more information on the Go website.
You can directly use go get
to put the Caduceator binary into your GOPATH
:
go get github.com/xmidt-org/caduceator
You can also clone the repository yourself and build using make:
mkdir -p $GOPATH/src/github.com/xmidt-org
cd $GOPATH/src/github.com/xmidt-org
git clone git@github.com:xmidt-org/caduceator.git
cd caduceator
make build
The Makefile has the following options you may find helpful:
make build
: builds the Caduceator binarymake docker
: builds a docker image for Caduceator, making sure to get all dependenciesmake local-docker
: builds a docker image for Caduceator with the assumption that the dependencies can be found alreadymake it
: runsmake docker
, then deploys Caduceator and a cockroachdb database into docker.make test
: runs unit tests with coverage for Caduceatormake clean
: deletes previously-built binaries and object files
First have a local clone of the source and go into the root directory of the repository. Then use rpkg to build the rpm:
rpkg srpm --spec <repo location>/<spec file location in repo>
rpkg -C <repo location>/.config/rpkg.conf sources --outdir <repo location>'
The docker image can be built either with the Makefile or by running a docker command. Either option requires first getting the source code.
See Makefile on specifics of how to build the image that way.
For running a command, either you can run docker build
after getting all
dependencies, or make the command fetch the dependencies. If you don't want to
get the dependencies, run the following command:
docker build -t caduceator:local -f deploy/Dockerfile .
If you want to get the dependencies then build, run the following commands:
GO111MODULE=on go mod vendor
docker build -t caduceator:local -f deploy/Dockerfile.local .
For either command, if you want the tag to be a version instead of local
,
then replace local
in the docker build
command.
WIP. TODO: add info
For deploying on Docker or in Kubernetes, refer to the deploy README.
For running locally, ensure you have the binary built. If the binary is in your current folder, run:
./caduceator
Refer to CONTRIBUTING.md.