views.py 355 B

12345678910111213
  1. from django_prometheus import exports
  2. from rest_framework.permissions import IsAdminUser
  3. from rest_framework.views import APIView
  4. from .metrics import compile_metrics
  5. class DjangoPrometheusMetrics(APIView):
  6. permission_classes = [IsAdminUser]
  7. def get(self, request):
  8. compile_metrics()
  9. return exports.ExportToDjangoView(request)