Closes #19965: Expand Prometheus metrics (#19966)

This commit is contained in:
Jeremy Stretch
2025-07-31 16:27:50 -04:00
committed by GitHub
parent 9a2fab1d48
commit ae55eed98f
5 changed files with 81 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ __all__ = (
'get_serializer_for_model',
'get_view_name',
'is_api_request',
'is_graphql_request',
)
@@ -60,6 +61,13 @@ def is_api_request(request):
return request.path_info.startswith(api_path) and request.content_type == HTTP_CONTENT_TYPE_JSON
def is_graphql_request(request):
"""
Return True of the request is being made via the GraphQL API.
"""
return request.path_info == reverse('graphql') and request.content_type == HTTP_CONTENT_TYPE_JSON
def get_view_name(view):
"""
Derive the view name from its associated model, if it has one. Fall back to DRF's built-in `get_view_name()`.