EST: 5 mins to understand and use
Very quick boilerplate code to get you going on golang instrumentation with prometheus
- Easily expose :2112/metrics for any service you want (you can change this port in main.go)
- Paste into your implementation and make any modifications you deem necessary, this should get you going really quickly
# terminal 1
./init.sh
./run.sh
# terminal 2
./curltest.sh
brew install watch
main.go creates a basic counter pmapp_infinite_ops_2s_total
:
- every 2s, counter++
- grep it out by doing
curl -s http://localhost:2112/metrics | grep pmapp_infinite_ops_2s_total
/ or runcurltest.sh