Store uWSGI stats as CloudWatch metrics.
This is in early development. There will be bugs.
- Your instance or resource running uwsgi-cloudwatch MUST be assigned an IAM role that allows you to put CloudWatch metrics into your designated namespace.
- uWSGI Stats Server must run on a network socket over HTTP. Support for unix file sockets is not currently supported, but could be added in the future.
- Python 3
pip install uwsgi-cloudwatch
First, run uWSGI as you would normally, but add the --stats
flag with a target port along with the --stats-http
flag to enable serving your stats over HTTP.
uwsgi --http :9090 --wsgi-file foobar.py --stats :9091 --stats-http
Then, point uwsgi-cloudwatch
to your stats server and specify a CloudWatch namespace:
uwsgi-cloudwatch http://localhost:9091 --namespace "Foo/Bar/Baz"
By default, uwsgi-cloudwatch will report metrics every minute. If you wanted to report every 5 minutes:
uwsgi-cloudwatch http://localhost:9091 --namespace "Foo/Bar/Baz" --frequency 300
To set the region, use --region
uwsgi-cloudwatch http://localhost:9091 --region eu-west-1
uWSGI Stats Server exposes stats that are made available as metrics:
- WorkerCount
- WorkerIdleCount
- WorkerBusyCount
- WorkerAcceptingCount
- WorkerRequestsCount
- WorkerDeltaRequestsCount
- WorkerAverageResponseTimeMilliseconds
- WorkerExceptionsCount
- WorkerHarakiriCount
- WorkerSignalsCount
- WorkerRssBytes
- WorkerVszBytes
- WorkerRunningTimeMilliseconds
- WorkerCoreCount
- WorkerCoreInRequestCount
- WorkerCoreStaticRequestsCount
- WorkerCoreRoutedRequestsCount
- WorkerCoreWriteErrorsCount
- WorkerCoreReadErrorsCount
- LocksUser0Count
- LocksFilemonCount
- LocksTimerCount
- LocksRbTimerCount
- LocksCronCount
- LocksRpcCount
- LocksSnmpCount
- SocketCount
- SocketQueueCount
- SocketMaxQueueCount
- SocketSharedCount
- SocketCanOffloadCount
- SignalQueueCount
- LoadCount
All metric names are prefixed with "uWSGI" by default, but you can also assign your own prefix:
uwsgi-cloudwatch http://localhost:9091 --namespace "Foo/Bar/Baz" --metric-prefix "QuxCorge"