The counter service exposes two http endpoints namely counter and metrics through two different http servers. The counter endpoint accepts the response code and increment the internal counter for the response code. The metrics endpoint exposes the counter for each response code which can be scaped by prometheus.
The service binary accepts the following command line arguments
-v bool set to enable verbose logging, default: false
-cp int counter server port, default: 8080
-mp int metric server port, default: 9201
Following command will start the service in verbose mode and the servers will run on non default ports passed through the flags.
counter -v -cp 8082 -mp 9203
The counter endpoint accepts the response code in a json body through PUT method.
curl -XPUT http://demohost:8082/counter -d '{"code": 401 }'
curl -XGET http://demohost:9203/metrics