Skip to content

Commit

Permalink
docs(py): Guide for exclude url
Browse files Browse the repository at this point in the history
> user path route

pinpoint-apm#609
  • Loading branch information
eeliu committed May 10, 2024
1 parent 24f9809 commit 16eac69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion testapps/django/mysite/mysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
set_agent("cd.dev.test.django", "cd.dev.test.py",
'tcp:dev-collector:10000', -1, 0, logging.DEBUG)


MIDDLEWARE = [
'pinpointPy.Django.DjangoMiddleWare',
'polls.middleware.UserMiddleWare',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand Down
15 changes: 15 additions & 0 deletions testapps/django/mysite/polls/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pinpointPy.Django import DjangoMiddleWare


def UserMiddleWare(get_response):

pinpoint_handle_request = DjangoMiddleWare(get_response)

def user_request_route(request):
if request.path in ['/heart_check']:
response = get_response(request)
else:
response = pinpoint_handle_request(request)
return response

return user_request_route

0 comments on commit 16eac69

Please sign in to comment.