Skip to content

django integration: fitering transactions by url #1569

Discussion options

You must be logged in to vote

hi @etienne-lebrun, for WSGI we include the wsgi_environ object inside sampling_context, so you can access the underlying request fields. Something like the following should work.

IGNORED_URLS = ["/ignore/this/url"]

def traces_sampler(sampling_context):
    path = sampling_context.get("wsgi_environ", {}).get("PATH_INFO", None)
    if path and path in IGNORED_URLS:
        return 0
    else:
        return 1

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@etienne-lebrun
Comment options

Answer selected by sl0thentr0py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1568 on August 16, 2022 12:51.