Fix sentry bug
This commit is contained in:
parent
09b6b2479e
commit
4fd09a0df0
|
|
@ -1,15 +1,18 @@
|
||||||
from django.http.request import HttpRequest
|
|
||||||
from graphql import get_operation_ast, parse
|
|
||||||
import requests
|
import requests
|
||||||
|
from core.logger import get_logger
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
from graphene_django.views import GraphQLView
|
from graphene_django.views import GraphQLView
|
||||||
|
from graphql import get_operation_ast, parse
|
||||||
from sentry_sdk.api import start_transaction
|
from sentry_sdk.api import start_transaction
|
||||||
from wagtail.admin.views.pages.listing import IndexView
|
from wagtail.admin.views.pages.listing import IndexView
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# For sentry perfomance monitoring
|
# For sentry perfomance monitoring
|
||||||
# taken from https://jerrynsh.com/how-to-monitor-python-graphql-api-with-sentry/
|
# taken from https://jerrynsh.com/how-to-monitor-python-graphql-api-with-sentry/
|
||||||
|
|
@ -30,7 +33,7 @@ class SentryGraphQLView(GraphQLView):
|
||||||
"""
|
"""
|
||||||
document = parse(query)
|
document = parse(query)
|
||||||
operation_type = get_operation_ast(document, operation_name).operation
|
operation_type = get_operation_ast(document, operation_name).operation
|
||||||
with start_transaction(op=operation_type, name=operation_name):
|
with start_transaction(op=str(operation_type), name=operation_name):
|
||||||
return super().execute_graphql_request(
|
return super().execute_graphql_request(
|
||||||
request, data, query, variables, operation_name, show_graphiql
|
request, data, query, variables, operation_name, show_graphiql
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue