[英]Monitoring django rest framework api on production server
DRF Tracking is utilities to track requests to DRF API views, it may be good fit for you: DRF跟踪是跟踪DRF API视图请求的实用程序,它可能适合您:
install: pip install drf-tracking
安装:
pip install drf-tracking
apply migrations: python manage.py migrate
应用迁移:
python manage.py migrate
add the following to you API views: 将以下内容添加到API视图中:
from rest_framework import generics
from rest_framework_tracking.mixins import LoggingMixin
class LoggingView(LoggingMixin, generics.GenericAPIView):
def get(self, request):
return Response('with logging')
There is also an other alternative Django Analytics if you want to have more than choice. 如果您想要的不仅仅是选择,还有另一种替代Django Analytics 。
So the simplest way to get started is to check your webserver's access logs. 因此,最简单的入门方法是检查您的网络服务器的访问日志。 That should give you the number of requests in and responses out, including status code.
这应该为您提供请求和响应的数量,包括状态代码。 If you want more feature-full statistics as well as monitoring and alerting, you may want to look into something like NewRelic.
如果您想要更多功能完整的统计信息以及监控和警报,您可能需要查看类似NewRelic的内容。
也许你可以使用drf-tracking
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.